delayedkarma/langchain-issues huggingface dataset:
Using URL-PlayWriter/PlayWright Browser Toolkit in Jupyter Notebook 
Labels: name: area: doc loader, name: auto:bug

### System Info

While using both URL-Playwriter or PlayWright Browser Toolkit I am getting this error. 
The solution I used:
1. I used asyncio.create_task
2. I used nest_asyncio.apply
but the error is the same. Please help if someone is also getting the same error and found some solution 

![image](https://github.com/langchain-ai/langchain/assets/32274469/a2c30690-46eb-454c-a954-1ef9d23ef150)


### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [X] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [X] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [X] Async

### Reproduction

![image](https://github.com/langchain-ai/langchain/assets/32274469/e2bb198a-558e-43f9-825d-31af6f36bf83)
![image](https://github.com/langchain-ai/langchain/assets/32274469/7f54eaf1-f1ad-40da-ac8f-8f7f4d6e85c6)


### Expected behavior

This code needs to return the documents of the html content, but I am getting error.
Fix typo in Etherscan.ipynb
Labels: name: area: doc loader, name: auto:documentation

specifc  -> specific

<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: a description of the change, 
  - Issue: the issue # it fixes (if applicable),
  - Dependencies: any dependencies required for this change,
  - Tag maintainer: for a quicker response, tag the relevant maintainer (see below),
  - Twitter handle: we announce bigger features on Twitter. If your PR gets announced and you'd like a mention, we'll gladly shout you out!

Please make sure you're PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use.

Maintainer responsibilities:
  - General / Misc / if you don't know who to tag: @baskaryan
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @baskaryan
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @hinthornw
  - Tracing / Callbacks: @agola11
  - Async: @agola11

If no one reviews your PR within a few days, feel free to @-mention the same people again.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
 -->
Issue: ModuleNotFoundError: No module named 'playwright'
Labels: name: area: agent, name: auto:bug

### Issue you'd like to raise.

 I encountered the issue while reproducing the section related to **[Structured tool chat](https://python.langchain.com/docs/modules/agents/agent_types/structured_chat)** in the documentation.


## This is the code (from docs)
```python
from langchain.tools.playwright.utils import create_async_playwright_browser
...

async_browser = create_async_playwright_browser()  # raise error here
...
```

## And this is the source code
```python
# ...\site-packages\langchain\tools\playwright\utils.py
def create_async_playwright_browser(headless: bool = True) -> AsyncBrowser:
    """
    Create an async playwright browser.

    Args:
        headless: Whether to run the browser in headless mode. Defaults to True.

    Returns:
        AsyncBrowser: The playwright browser.
    """
    from playwright.async_api import async_playwright  # raise error here

    browser = run_async(async_playwright().start())
    return run_async(browser.chromium.launch(headless=headless))
```

## The error info
```
Traceback (most recent call last):
  File "...\08_structured_tool_chat.py", line 16, in <module>
    async_browser = create_async_playwright_browser()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\site-packages\langchain\tools\playwright\utils.py", line 63, in create_async_playwright_browser
    from playwright.async_api import async_playwright
ModuleNotFoundError: No module named 'playwright'
```
---
I'm confused.
就有点迷@_@

### Suggestion:

_No response_
Add support custom http headers in AzureMLOnlineEndpoint
Labels: name: auto:improvement

Description: 
support adding custom http headers when use AzureMLOnlineEndpoint through ContentFormatterBase

Issue: 
when using AzureMLOnlineEndpoint through ContentFormatterBase, I am unable to add any HTTP request header elements that I want.

Dependencies: 
no dependencies required

Details:
1. Add a dictionary-type member variable named 'headers' to class ContentFormatterBase
2. Pass the 'headers' of the instance object of "ContentFormatterBase" to the "client" member in class AzureMLOnlineEndpoint

Possible tag maintainer：
@baskaryan @hwchase17 @agola11 

Thanks!
Update tagging.ipynb
Labels: name: auto:documentation

for langchain version 0.0.240 the create_tagging_chain and create_tagging_chain_pydantic will come under langchain.chains.openai_functions.tagging.

<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: a description of the change, 
  - Issue: the issue # it fixes (if applicable),
  - Dependencies: any dependencies required for this change,
  - Tag maintainer: for a quicker response, tag the relevant maintainer (see below),
  - Twitter handle: we announce bigger features on Twitter. If your PR gets announced and you'd like a mention, we'll gladly shout you out!

Please make sure you're PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use.

Maintainer responsibilities:
  - General / Misc / if you don't know who to tag: @baskaryan
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @baskaryan
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @hinthornw
  - Tracing / Callbacks: @agola11
  - Async: @agola11

If no one reviews your PR within a few days, feel free to @-mention the same people again.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
 -->
support adding custom http headers when use AzureMLOnlineEndpoint through ContentFormatterBase
Labels: name: auto:improvement

Description: support adding custom http headers when use AzureMLOnlineEndpoint through ContentFormatterBase
Issue:  hen using AzureMLOnlineEndpoint through ContentFormatterBase, I am unable to add any HTTP request header elements that I want.
Dependencies: no dependencies required

Details:
1. Add a dictionary-type member variable named 'headers' to class ContentFormatterBase
2. Pass the 'headers' of the instance object of "ContentFormatterBase" to the "client" member in class AzureMLOnlineEndpoint

 Thank you for your review!
Error finding in multiple pdfs
Labels: name: area: vector store, name: auto:bug

### Issue you'd like to raise.

When I have a single PDF file it works very well, when I have several files it does not find the same question as if it did when there was only one pdf file, I have the following code


store = PGVector(
    collection_name=COLLECTION_NAME,
    connection_string=CONNECTION_STRING,
    embedding_function=embeddings,
)


pdf_qa = ConversationalRetrievalChain.from_llm(
    ChatOpenAI(temperature=0.9, model_name="gpt-3.5-turbo"),
    store.as_retriever(search_kwargs={'k': 2}),
    return_source_documents=True,
    verbose=False
)


When I increase the value of search_kwargs to 7 it works, because I think it takes a bigger chunk and finds the answer.
Please help

### Suggestion:

_No response_
Issue: Max CSV Size
Labels: name: area: embeddings, name: auto:question

### Issue you'd like to raise.

I have a csv file I would like to interact with but when I start using it says:

Retrying langchain.embeddings.openai.embed_with_retry.<locals>._embed_with_retry in 4.0 seconds as it raised APIError: OpenAI API returned an empty embedding.
Retrying langchain.embeddings.openai.embed_with_retry.<locals>._embed_with_retry in 4.0 seconds as it raised APIError: OpenAI API returned an empty embedding.
Retrying langchain.embeddings.openai.embed_with_retry.<locals>._embed_with_retry in 4.0 seconds as it raised APIError: OpenAI API returned an empty embedding.
Retrying langchain.embeddings.openai.embed_with_retry.<locals>._embed_with_retry in 8.0 seconds as it raised APIError: OpenAI API returned an empty embedding.
Retrying langchain.embeddings.openai.embed_with_retry.<locals>._embed_with_retry in 10.0 seconds as it raised APIError: OpenAI API returned an empty embedding.

Do you know the max size for a csv file or for any file for that matter?
My file is 12 MB.

Thanks

### Suggestion:

_No response_
Upgrade to Pydantic v2
Labels: name: auto:improvement

This PR should encompass (most of) the changes needed to support [Pydantic v2](https://docs.pydantic.dev/2.0/blog/pydantic-v2-final/)

Relevant Issue: https://github.com/langchain-ai/langchain/issues/6841

Dependency wise, had to bump Pydantic (ofc) and `autodoc-pydantic` which has a yanked 2.0.0 pypi deploy which is being used as a Release Candidate for pydantic v2 support.

Currently, the following deps are preventing poetry from resolving a lock file:
- zep-python (issue opened here - https://github.com/getzep/zep-python/issues/58)
- octoai-sdk (closed source xdd)
- chromadb (issue opened here - https://github.com/chroma-core/chroma/issues/893)
- spacy (issue here - https://github.com/explosion/spaCy/issues/12611)
- steamship (issue opened here - https://github.com/steamship-core/python-client/issues/503)
- langsmith (closed source xdd)

@baskaryan


Opened as a draft because until poetry resolves the lock file and downstream packages get resolved, it shouldn't be merged.

Also since PR guidelines suggests, twitter handle is SexualRhino_
Async Memory
Labels: name: area: memory, name: auto:enhancement

### Feature request

I propose to make BaseMemoryAsync, BaseChatMessageHistoryAsync, SummarizerMixinAsync, BaseChatMemoryAsync and add support for async save_context to the main Chain class. For web development, everything is asynchronous, and this is critical.

### Motivation

I've faced a problem when writing a chatbot using the asynchronous aiogram library, I can't use Memory asynchronously, so I want to add additional classes that support asynchronous memory work. I am using asynchronous sqlalchemy and cannot work with memory. Besides, I think this is a really critical feature.

### Your contribution

I tried to implement this, but it turned out to be too difficult, so I'm asking you very much, give me and other people the opportunity to work with memory asynchronously.
Issue: How to extract quotes from a large file
Labels: name: area: doc loader, name: auto:question, name: auto:improvement

### Issue you'd like to raise.

This might be a general issue with LLM tools but I wanted to pose it here since this community is very active. 

When you feed a huge CSV file with thousands of comments, you are trying to summarize them but also extract some quotes. 

When feeding this file into Langchain, it will summarize just fine. However, the quotes will get lost when reducing the result. The quotes will end up being summarized and lose their data integrity 

Is there a way around this issue? Can this solved by tweaking the system prompt?

### Suggestion:

_No response_
SagemakerEndpoint LLM does not support InvokeEndpoint CustomAttributes needed for Llama-V2
Labels: name: auto:improvement

### Feature request

Add support for passing CustomAttributes to the `SagemakerEnpiontLLM` wrapper around `client.invoke_enpoint()`
With the release of LLama-v2 on Sagemaker Jumpstart, we are required to pass EULA=TRUE # END USER LICENSE AGREEMENT

Endstate
```python 

class SagemakerEndpoint(LLM):
       ...
       ...
       custom_attributes: Dict

      
       custom_attributes = 
       # send request
       try:
            response = self.client.invoke_endpoint(
                EndpointName=self.endpoint_name,
                Body=body,
                ContentType=content_type,
                Accept=accepts,
                Custom_Attributes=self.custom_attributes
                **_endpoint_kwargs,
            )
       except Exception as e:
            raise ValueError(f"Error raised by inference endpoint: {e}")
```

### Motivation

Lanchain is incompatible with llama-v2 model using SagemakerEnpointLLM in langchain

without the fix, Lanchain throws an error

`Unknown parameter in input: "accept_eula", must be one of: EndpointName, Body, ContentType, Accept, CustomAttributes, TargetModel, TargetVariant, TargetContainerHostname, InferenceId, EnableExplanations`

### Your contribution

Happy to create a PR
DOC: How to use OPENAI_MULTI_FUNCTIONS with custom prompt?
Labels: name: area: agent, name: auto:question, name: auto:documentation

### Issue with current documentation:

I am converting from CONVERSATIONAL_REACT agent to Functions and having a tough time figuring out how to customize the prompt. Memory was not obvious, but worked as expected. However, adding additional inputs does not:

``` Python
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=False)

template = """
The Human is named {user_name}. Always answer questions by directing it at the Human by name.
For example, if the Human asks "What is the weather like?", you should answer "It is sunny, {user_name}." instead of just "It is sunny.".

History of the conversation:

{chat_history}

"""
extra_prompt = SystemMessagePromptTemplate.from_template(
    template=template,
    input_variables=["chat_history", "user_name"], 
)

agent_args = {
    "extra_prompt_messages": [extra_prompt],
}

mrkl_chat = initialize_agent(
    tools,
    llm,
    agent=AgentType.OPENAI_MULTI_FUNCTIONS,
    memory=memory,
    agent_kwargs=agent_args,
    verbose=True,
)
```

This works, but trying to run using
``` Python
mrkl_chat.run(input="What is fity six times twenty seven?", user_name="John")
```
executes the function call correctly, but then errors:
```
ValueError: One input key expected got ['input', 'user_name']
```

How do I pass in the extra inputs?

### Idea or request for content:

Please extend the examples for the FUNCTIONS agent to include customizing the prompt.
Async memory
Labels: name: area: memory, name: auto:improvement

I have faced a problem when writing a chatbot using the asynchronous aiogram library, I cannot use Memory asynchronously, so I want to add additional classes that support asynchronous work with Memory. I created several classes that allow you to call functions asynchronously BaseMemoryAsync, BaseChatMessageHistoryAsync, SummarizerMixinAsync, BaseChatMemoryAsync. Using them, I will be able to make asynchronous queries to the database and summarize the chat history.
 
@agola11, @hwchase17
Whisper with word-level timestamps
Labels: name: auto:enhancement

### Feature request

Hi,

this repo on huggingface implements word-level timestamps into locally run whisper models: https://huggingface.co/spaces/Matthijs/whisper_word_timestamps/tree/main

I have created a simple modification of this for generating simple CSVs with words and timestamps, a functionality i'd love to see in langchain too: https://github.com/SimonB97/whisper-word-ts-csv (currently only running with cuda support, but should be modifiable to dynamically support both cpu and gpu).

### Motivation

It would be amazing to be able to generate word-level timestamps together with transcriptions, for example to be able to pin-point when some information in a youtube video was given.

### Your contribution

I'm unsure how to implement this in langchain, would be willing to help though!
Support using RunnableMap directly
Labels: name: auto:improvement

<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: a description of the change, 
  - Issue: the issue # it fixes (if applicable),
  - Dependencies: any dependencies required for this change,
  - Tag maintainer: for a quicker response, tag the relevant maintainer (see below),
  - Twitter handle: we announce bigger features on Twitter. If your PR gets announced and you'd like a mention, we'll gladly shout you out!

Please make sure you're PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use.

Maintainer responsibilities:
  - General / Misc / if you don't know who to tag: @baskaryan
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @baskaryan
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @hinthornw
  - Tracing / Callbacks: @agola11
  - Async: @agola11

If no one reviews your PR within a few days, feel free to @-mention the same people again.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
 -->
Fix entity extraction not to include \nEND OF EXAMPLE in each entity
Labels: name: area: memory, name: auto:bug

Description: Revise the default entity extraction template so that each extracted entity doesn't have unnecessary part '\nEND OF EXAMPLE' at the end.

Issue: Run an example in the Entity memory documentation. When an entity is extracted, it has unnecessary part  '\nEND OF EXAMPLE' at the end, e.g., 'Sam\nEND OF EXAMPLE'.
In the AmazonKendraRetriever, allow selection of which API to use: query or retrieve (default)
Labels: name: auto:improvement

### Feature request

According to the [Amazon Kendra documentation](https://docs.aws.amazon.com/kendra/latest/APIReference/API_Query.html), a query response contains three types of results:
- **Relevant suggested answers.** The answers can be either a text excerpt or table excerpt. The answer can be highlighted in the excerpt.
- **Matching FAQs** or questions-answer from your FAQ file.
- Relevant documents. This result type includes an excerpt of the document with the document title. The searched terms can be highlighted in the excerpt.

Therefore, the AmazonKendraRetriever should be flexible to allow a retrieval pattern that combines the query API with the retrieve API or not. 

For instance, the application could:
- use the query API to check for relevant answers or matching FAQs before calling another retriever with the retrieve API;
- explore the [Merger Retriever](https://python.langchain.com/docs/integrations/retrievers/merger_retriever) to combine the results of the retrieve and query APIs.

### Motivation

Currently, the AmazonKendraRetrieve uses the retrieve API by default and fall backs to the query API in case the retrieve API  results are empty.

### Your contribution

I could submit a PR.
Fixes #8310 Fix maximum recursion depth exceeded error
Labels: name: lgtm, name: area: vector store, name: auto:bug

ElasticsearchVectorStore.as_retriever() method is returning 
`RecursionError: maximum recursion depth exceeded` 
because of incorrect field reference in
 `embeddings()` method

<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: Fix RecursionError because of a typo
  - Issue: the issue #8310 
  - Dependencies: None,
  - Tag maintainer: @eyurtsev
  - Twitter handle: bpatel

Please make sure you're PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use.

Maintainer responsibilities:
  - General / Misc / if you don't know who to tag: @baskaryan
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @baskaryan
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @hinthornw
  - Tracing / Callbacks: @agola11
  - Async: @agola11

If no one reviews your PR within a few days, feel free to @-mention the same people again.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
 -->
Fixes #8310 Fix maximum recursion depth exceeded error
Labels: name: lgtm, name: area: vector store, name: auto:bug

ElasticsearchVectorStore.as_retriever() method is returning RecursionError: maximum recursion depth exceeded because of incorrect field reference in
 embeddings() method

<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: Fix RecursionError 
  - Issue: the issue #8310 
  - Dependencies: any dependencies required for this change,
  - Tag maintainer: @eyurtsev
  - Twitter handle: bpatel

Please make sure you're PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use.

Maintainer responsibilities:
  - General / Misc / if you don't know who to tag: @baskaryan
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @baskaryan
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @hinthornw
  - Tracing / Callbacks: @agola11
  - Async: @agola11

If no one reviews your PR within a few days, feel free to @-mention the same people again.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
 -->
ElasticVectorSearch().as_retriever() throwingRecursionError: maximum recursion depth exceeded
Labels: name: area: embeddings, name: area: vector store, name: auto:bug

### System Info

langchain==0.0.243


```
@property
def embeddings(self) -> Embeddings:
    return self.embeddings
```
is referencing itself instead of `self.embedding` resulting in Recursion error.

```
    return self.embeddings
           ^^^^^^^^^^^^^^^
  [Previous line repeated 993 more times]
RecursionError: maximum recursion depth exceeded
```


### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [X] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

```
vectordb = ElasticVectorSearch(
        elasticsearch_url=elasticsearch_url,
        embedding=OpenAIEmbeddings()
        index_name="some-index"
    )
retriever = vectorstore.as_retriever(search_kwargs={"k": 3})
```

### Expected behavior

Should not get RecursionError