delayedkarma/langchain-issues huggingface dataset:
ValueError: ChatAgent does not support multi-input tool do_my_job. with a non-argaument function
Labels: name: area: agent, name: auto:bug

### System Info

OS: Linux Mint 21.2 Cinnamon
Python 3.10
LangChain v0.0.251

### 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
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [X] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

I defined a function like:

```python
@tool
def do_my_job() -> list:
    """Just do my job"""
    return []
```

Obviously it has none of arguments.

After I made an agent and run:

```python
lc_tools = [
    tool.do_my_job
]
lc_agent_executor = initialize_agent(agent=AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION, llm=lc_llm, tools=lc_tools,
                            verbose=config.verbose)
lc_reply = lc_agent_executor.run("do my job")
```

I got this error: `ValueError: ChatAgent does not support multi-input tool do_my_job.`, which raised at `langchain.agents.utils.py`:

```python
def validate_tools_single_input(class_name: str, tools: Sequence[BaseTool]) -> None:
    """Validate tools for single input."""
    for tool in tools:
        if not tool.is_single_input:
            raise ValueError(
                f"{class_name} does not support multi-input tool {tool.name}."
            )
```

When the function `do_my_job` has arguments = 1, the `tool.is_single_input` was `True`
When the function `do_my_job` has arguments > 1, the `tool.is_single_input` was `False`
When the function `do_my_job` has arguments < 1, the `tool.is_single_input` was `False`

I can specify an unused argument for the function, but it is a bit weird.

Should this check be correct?

### Expected behavior

Non-argument functions should work with **Zero-shot ReAct**
RSS Feed / OPML loader
Labels: name: lgtm, name: area: doc loader, name: auto:enhancement

Replace this comment with:
  - Description: added a document loader for a list of RSS feeds or OPML. It iterates through the list and uses NewsURLLoader to load each article.
  - Issue: N/A
  - Dependencies: feedparser, listparser
  - Tag maintainer: @rlancemartin, @eyurtsev
  - Twitter handle: @ruze
Continuing LLM response parsing problems after 250(251)
Labels: name: area: agent, name: auto:bug

### System Info

ubuntu 
[v0.0.250](https://github.com/langchain-ai/langchain/releases/tag/v0.0.250)

### Who can help?

@hwchase17 @agola11 @hwchase17

### Information

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

### Related Components

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

### Reproduction

1. implement multi input structured tool
2. enter user input to trigger the tool
3. check parsing

have had a chance to read and review earlier related regex and other parsing issues filed earlier some of which were marked as solved with 249 and 250 but continuing to have parsing issues
for example
https://github.com/langchain-ai/langchain/pull/7511
which is merged

when invoking a multi input structured tool

LLM returns
```
> Entering new AgentExecutor chain...
Could not parse LLM output: Action:
```json
{
  "action": "image_generate",
  "action_input": {
    "prompt": "Draw a cat"
  }
```
 with extra 'json' before the valid json which is then cannot parse
 
  2. have tried to handle this in the system prompt with (one example but tried multiple):
  
```
  _SUFFIX = ("Don't ask the user to confirm if you are pretty sure what you need to do in order to fulfill the request. "
           "For example, don't ask the user 'I can DO X. Would you like me to do that?', just do it. "
           "Make sure that any JSON you return is fully valid, does not include any extra 'json' text before the JSON object. "
           "For example, If you see you are generating a JSON that looks like this"
           "```json"
           "{{\"action\": \"edit_image\",\"action_input\": {{\"image_path\": \"sandbox:/images/edited_from_image_a1bc6dbb-1127-49d5-898a-d35c3bb1564d.png\",\"prompt\": \"Make the drawing even more basic\"}}}}"
           "``` and has the text 'json' before the valid JSON object, remove the extra 'json' text at the start so that your final output is ```"
           "{{\"action\": \"edit_image\",\"action_input\": {{\"image_path\": \"sandbox:/images/edited_from_image_a1bc6dbb-1127-49d5-898a-d35c3bb1564d.png\",\"prompt\": \"Make the drawing even more basic\"}}}}"
           "``` without the json"
           "Chat history:\n{chat_history}\n\n") + _SUFFIX
```

any help in trying to either parse better or instruct the LLM to provide a better answer would be appreciated.  
thank in advance.  
  

### Expected behavior

either 

1) works out of the box with another version of the 
https://github.com/langchain-ai/langchain/pull/7511
resolution 

2) works with additional LLM system prompt SUFFIX instructions if need be.  
have tried a bunch of variations can't get it to work,
AttributeError: module 'cohere' has no attribute 'AsyncClient'
Labels: name: auto:bug

### System Info

langchain                 0.0.250
langchainplus-sdk         0.0.20
Python 3.8.10

### Who can help?

_No response_

### Information

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

### Related Components

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

### Reproduction

from langchain import Cohere
llm = Cohere(temperature=0.9, cohere_api_key=cohere_api_key)

### Expected behavior

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[6], line 1
----> 1 llm = Cohere(temperature=0.9, cohere_api_key=cohere_api_key)

File /opt/miniconda3/envs/ai/lib/python3.8/site-packages/langchain/load/serializable.py:74, in Serializable.__init__(self, **kwargs)
     73 def __init__(self, **kwargs: Any) -> None:
---> 74     super().__init__(**kwargs)
     75     self._lc_kwargs = kwargs

File /opt/miniconda3/envs/ai/lib/python3.8/site-packages/pydantic/main.py:339, in pydantic.main.BaseModel.__init__()

File /opt/miniconda3/envs/ai/lib/python3.8/site-packages/pydantic/main.py:1102, in pydantic.main.validate_model()

File /opt/miniconda3/envs/ai/lib/python3.8/site-packages/langchain/llms/cohere.py:127, in Cohere.validate_environment(cls, values)
    124     import cohere
    126     values["client"] = cohere.Client(cohere_api_key)
--> 127     values["async_client"] = cohere.AsyncClient(cohere_api_key)
    128 except ImportError:
    129     raise ImportError(
    130         "Could not import cohere python package. "
    131         "Please install it with `pip install cohere`."
    132     )

AttributeError: module 'cohere' has no attribute 'AsyncClient'
Add BasePromptTemplate.formatters which act on input variables before  they are passed to template string
Labels: name: auto:improvement



Default formatters for list, dict and Document

<!-- 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
 -->
Fixed error handle null value in csv file
Labels: name: area: doc loader, name: auto:bug

<!-- 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
 -->
Small improvements for tracer and debug output of runnables
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
 -->
Handle duplicate IDs error when using langchain.vectorstores.Chroma.from_documents
Labels: name: area: vector store, name: auto:bug

### System Info

Related [Stackoverflow](https://stackoverflow.com/questions/76414862/how-do-you-catch-the-duplicate-id-error-when-using-langchain-vectorstores-chroma) post. Is there any way to avoid duplicated IDs and only insert new ones.
@agola11 

### Who can help?

_No response_

### Information

- [X] 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

```python
Chroma.from_documents(docs, embeddings, ids=ids, persist_directory='db')
```

### Expected behavior

Non-duplicate IDs get added
Unable to import Html2TextTransformer from langchain.document_transformers
Labels: name: area: doc loader, name: auto:bug

### System Info

langchain==0.0.250

Experiencing error when importing Html2TextTransformer
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[79], line 1
----> 1 from langchain.utils.math import cosine_similarity

ModuleNotFoundError: No module named 'langchain.utils.math'; 'langchain.utils' is not a package

### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [X] 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
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

from langchain.document_transformers import Html2TextTransformer

### Expected behavior

Importing successfully.
DOC: What is the difference between LOTR(Merger Retriever) and Ensemble Retriever
Labels: name: area: doc loader, name: auto:documentation

### Issue with current documentation:

https://python.langchain.com/docs/integrations/retrievers/merger_retriever

https://python.langchain.com/docs/modules/data_connection/retrievers/ensemble

seems like the same.

Both task a list of exist retriever and MERGE the output together.

### Idea or request for content:

Should describe the difference between the both.
what is the difference between the combine agents &vector stores and vectorstore agent?
Labels: name: area: agent, name: area: vector store, name: auto:question

combine agents &vector stores - https://python.langchain.com/docs/modules/agents/how_to/agent_vectorstore
vectorstore agent - https://python.langchain.com/docs/integrations/toolkits/vectorstore
what is the diffeence between these two?
Failed to calculate number of tokens, falling back to approximate count
Labels: name: auto:bug

### System Info

Hi guys, I wanted to ask you does anyone know where is the problem with this because Im getting an error: (Failed to calculate number of tokens, falling back to approximate count) after trying to make a request to open ai by using langchain and sql database connection. On the request I can see that there is a property with max_tokens: 256, is there a problem with the api key or pricing plan or anything related to the database size?

The version of langchain library that Im using is "langchain": "0.0.110",

### 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
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [x] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

Im trying to chat with my database and Im getting the error above.

### Expected behavior

It is showing me an error (Failed to calculate number of tokens, falling back to approximate count) and it is taking so much time to load.
RunError of langchain's tutorial in deeplearning.ai, L3-Chains
Labels: name: auto:bug

### Issue you'd like to raise.

I learn the langchain lessions, and found some error while running the jupyter code at
`https://learn.deeplearning.ai/langchain/lesson/4/chains`, 
precisily, MULTI_PROMPT_ROUTER_TEMPLATE is not working well in the first run,
1）It raise the folloing error,
```
OutputParserException: Parsing text
{
    "destination": "physics",
    "next_inputs": "What is black body radiation?"
}
 raised following error:
Got invalid return object. Expected markdown code snippet with JSON object, bu
```
Then I add additional example I/O (after <<OUTPUT>>) for it, 
```
eg:
<< INPUT >>
"What is black body radiation?"
<< OUTPUT >>
\```json
{{{{
    "destination": string \ name of the prompt to use or "DEFAULT"
    "next_inputs": string \ a potentially modified version of the original input
}}}}
\```
```
It works, but still error at routing to default path as I ask it "Why does every cell in our body contain DNA?"
2) It tried to route to biology, but failed to get response.
```
ValueError: Received invalid destination chain name 'biology'
```

How can I get stable running result? Or,this issue is one of the flaws of current llm, which cannot ensure that all outputs are processed according to our specified style?

Thanks a lot.


### Suggestion:

_No response_
Getting model args exception while using ManifestWrapper
Labels: name: auto:bug

### System Info

Hi, I'm trying to interact with HuggingFace model (NumbersStation/nsql-llama-2-7B) using manifest but when I try to to send it a prompt I'm getting the following error from the model:
`The following 'model_kwargs' are not used by the model: ['token_type_ids'] (note: typos in the generate arguments will also show up in this list)`

I tried to find out how to control the mode_kwargs in the ManifestWarpper but didn't find such.
That's how I configured the wrapper:

```
local_llm = ManifestWrapper(
        client=manifest,
        llm_kwargs={"temperature": 0.0, "max_tokens": 1024},
        verbose=True
    )
```

and that's how I ran the model using Manifest (on my local machine):
```
python3 -m manifest.api.app \
    --model_type huggingface \
    --model_generation_type text-generation \
    --model_name_or_path nsql-llama-2-7B \
    --device 0
```

Would like some help here :)

### Who can help?

_No response_

### Information

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

### Related Components

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

### Reproduction

1. Run the model locally using Manifest
2. connect to it using ManifestWrapper.
3. send a simple prompt with LLMChain. 

### Expected behavior

Getting response from the model.
how to set chat_history for different user
Labels: name: area: memory, name: auto:question

### Issue you'd like to raise.

I just want to set chat history for different user in ConversationBufferMemory, user can only get his own chathistory
this is my code：

    **embeddings = OpenAIEmbeddings(model="text-embedding-ada-002", chunk_size=1000)
 
    docsearch = Chroma.from_documents(split_docs, embeddings)
    memory = ConversationBufferMemory(memory_key="chat_history")
 
    qa = RetrievalQA.from_chain_type(llm=OpenAI(), chain_type="map_rerank", 
   retriever=docsearch.as_retriever(),memory=memory, return_source_documents=False)**

could anyone give me some advice please 


### Suggestion:

_No response_
add model_revison parameter to ModelScopeEmbeddings
Labels: name: lgtm, name: area: embeddings, name: auto:improvement

<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: add model_revison parameter to ModelScopeEmbeddings, 
  - 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: < Emails are not being sent though it shows emails sent successfully >
Labels: name: area: agent, name: auto:bug

### Issue you'd like to raise.

I am trying to send emails using the `ZapierNLAWrapper`. Though it shows emails have been sent successfully, I could not find sent emails in gmail.

```
from langchain.chains import TransformChain
from langchain.tools.zapier.tool import ZapierNLARunAction
from langchain.utilities.zapier import ZapierNLAWrapper
from langchain.agents import initialize_agent
from langchain.agents.agent_toolkits import ZapierToolkit
from langchain.agents import AgentType

zapier = ZapierNLAWrapper(zapier_nla_api_key="")
actions = zapier.list()

toolkit = ZapierToolkit.from_zapier_nla_wrapper(zapier)
agent = initialize_agent(toolkit.get_tools(), llm, agent="zero-shot-react-description", verbose=True)

agent.run(
    f"The emails of the shortlisted candidates are the following: arghyadutta119@gmail.com and nileshpal530@gmail.com. Their names are Arghya and Nilesh respectively. Send emails to them, In the body of the email, congratulate them on their selection and inform them about the next steps in the hiring process."
)

```


Here is the Verbose log:

```
> Entering new AgentExecutor chain...
I need to send emails to the shortlisted candidates. I should use the Gmail: Send Email tool.
Action: Gmail: Send Email
Action Input: 
- Subject: "Congratulations on Your Selection"
- Body: "Dear [Candidate's Name],\n\nCongratulations on being shortlisted for the position! We are pleased to inform you that you have been selected to proceed to the next steps in the hiring process. We will be contacting you shortly with more details.\n\nBest regards,\n[Your Name]"
- To: "arghyadutta119@gmail.com"
- Cc: "nileshpal530@gmail.com"
Observation: null
Thought:The email has been sent to the first candidate. I need to send the email to the second candidate now.
Action: Gmail: Send Email
Action Input: 
- Subject: "Congratulations on Your Selection"
- Body: "Dear [Candidate's Name],\n\nCongratulations on being shortlisted for the position! We are pleased to inform you that you have been selected to proceed to the next steps in the hiring process. We will be contacting you shortly with more details.\n\nBest regards,\n[Your Name]"
- To: "nileshpal530@gmail.com"
- Cc: "arghyadutta119@gmail.com"
Observation: null
Thought:Both emails have been sent successfully.
Final Answer: The emails have been sent to the shortlisted candidates.

> Finished chain.
```


### Suggestion:

_No response_