delayedkarma/langchain-issues huggingface dataset:
GPT4All generate() TypeError 'n_ctx' since a commit on GPT4All's python binding changed arguments
Labels: name: auto:bug

### System Info

- langchain-0.0.222 (and all before)
- Any GPT4All python package after [this commit](https://github.com/nomic-ai/gpt4all/commit/46a0762bd5a7e605e9bd63e4f435b482eff026f6#diff-cc3ea7dfbfc9837a4c42dae1089a1eda0ed175d17f2628cf16c13d3cd9da6e13R174) was merged. So latest: >= 1.0.1.

Note this issue is in langchain caused by GPT4All's change. We need to alter the _default_params() return values to exclude many keys that were removed from GPT4All's function kwargs.

### Who can help?

@hwchase17 @agola11 👋

### Information

- [ ] The official example notebooks/scripts
- [X] 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

1. Install the latest gpt4all package: `pip install --upgrade gpt4all`
2. Use the GPT4All LLM and LLMChain as normal (llm = GPT4All(model="ggml.gpt4all.xyz.bin"); chain = LLMChain(llm, prompt=any_prompt))
3. Run the chain: chain("prompt")
4. TypeError: generate() got an unexpected keyword argument 'n_ctx'

### Expected behavior

Should not cause TypeError. It should not pass n_ctx from default parameters to GPT4All's `generate()`
PowerBI updates
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!

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
 -->

Several updates for the PowerBI tools:

- Handle 0 records returned by requesting redo with different filtering
- Handle too large results by optionally tokenizing the result and comparing against a max (change in signature, non-breaking)
- Implemented LLMChain with Chat for chat models for the tools. 
- Updates to the main prompt including tables
- Update to Tool prompt with TOPN function
- Split the tool prompt to allow the LLMChain with ChatPromptTemplate

Smaller fixes for stability.

For visibility: @hinthornw
Caching: allows to cache only the prompt
Labels: name: auto:improvement

### Feature request

Hi there 👋 

Thanks a lot for the awesome library. The current implementation of `BaseCache` stores the prompt + the llm generated text as key. 

This means that I am not really caching since I'll have to do a request to OpenAI to get the llm text



### Motivation

I'd like to cache a prompt 

### Your contribution

I am willing to contribute but you need to explain me how :)
H2O Wave callback integration
Labels: name: auto:enhancement

### Feature request

I would love to add an [H2O Wave](https://wave.h2o.ai/) framework callback integration in a similar manner as done for [Streamlit](https://python.langchain.com/docs/modules/callbacks/integrations/streamlit). Wave has recently added a dedicated chatbot card, which seems like a perfect fit.

![image](https://miro.medium.com/v2/resize:fit:720/format:webp/1*ERjc3hE3zrXgGxpPyvt9Kw.png)

![image](https://miro.medium.com/v2/resize:fit:640/1*YLJZlY31wkJzwajcRCmfUg.gif)

### Motivation

This would allow for bringing more diversity when it comes to Python UI frameworks + Langchain integration. Moreover, Wave is async by nature, so seems like [custom async callback](https://python.langchain.com/docs/modules/callbacks/how_to/async_callbacks) or maybe an [async generator](https://github.com/hwchase17/langchain/blob/master/langchain/callbacks/streaming_aiter.py) would do.

### Your contribution

I am willing to provide the PR with everything that is needed.
Returns the standone alone question while using ConversationalRetrievalChain 
Labels: name: auto:improvement

### Feature request

I am using the ConversationalRetrievalChain to retrieve answers for questions while condensing the chat history to a standalone question.  However, the standalone question would show in the streaming output. 

I expect only to return the final answer. Is there any way to achieve it?

### Motivation

The immediate is not necessary for the answer.

### Your contribution

I am not sure.
"ConversationBufferMemory" object has no field "buffer" 
Labels: name: auto:bug

### System Info

0.0.220

### 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
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

self.memory = ConversationBufferMemory(memory_key="chat_history", output_key='output')
self.agent.memory.buffer = self.agent.memory.buffer + Human_prompt + 'AI: ' + AI_prompt

### Expected behavior

no error output
Added documentation for add_texts function for Pinecone integration
Labels: name: lgtm, name: auto:documentation

- Description: added some documentation to the Pinecone vector store docs page. 
- Issue: #7126 
- Dependencies: None
- Tag maintainer: @baskaryan 

I can add more documentation on the Pinecone integration functions as I am going to go in great depth into this area. Just wanted to check with the maintainers is if this is all good.
Add HugeGraphQAChain to support gremlin generating chain
Labels: name: lgtm, name: auto:enhancement, name: auto:documentation

[Apache HugeGraph](https://github.com/apache/incubator-hugegraph) is a convenient, efficient, and adaptable graph database, compatible with the Apache TinkerPop3 framework and the Gremlin query language.

In this PR, the HugeGraph and HugeGraphQAChain provide the same functionality as the existing integration with Neo4j and enables query generation and question answering over HugeGraph database. The difference is that the graph query language supported by HugeGraph is not cypher but another very popular graph query language [Gremlin](https://tinkerpop.apache.org/gremlin.html).

A notebook example and a simple test case have also been added.

Tag maintainer: @hwchase17 @dev2049 thanks
Issue: Can not import the Langchain modules.
Labels: name: auto:bug

### Issue you'd like to raise.

I installed "langchain==0.0.27" on a linux machine but i am getting the folowing error when i try to import langchain in a script. Was running this with python 3.7.


`/home/s0s06c3/lang/lang_env/bin/python /home/s0s06c3/lang/hugging_lanchain.py
Traceback (most recent call last):
  File "/home/s0s06c3/lang/hugging_lanchain.py", line 2, in <module>
    from langchain import PromptTemplate, HuggingFaceHub, LLMChain
  File "/home/s0s06c3/lang/lang_env/lib/python3.7/site-packages/langchain/__init__.py", line 8, in <module>
    from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
  File "/home/s0s06c3/lang/lang_env/lib/python3.7/site-packages/langchain/agents/__init__.py", line 2, in <module>
    from langchain.agents.agent import Agent
  File "/home/s0s06c3/lang/lang_env/lib/python3.7/site-packages/langchain/agents/agent.py", line 10, in <module>
    from langchain.chains.base import Chain
  File "/home/s0s06c3/lang/lang_env/lib/python3.7/site-packages/langchain/chains/__init__.py", line 2, in <module>
    from langchain.chains.conversation.base import ConversationChain
  File "/home/s0s06c3/lang/lang_env/lib/python3.7/site-packages/langchain/chains/conversation/base.py", line 7, in <module>
    from langchain.chains.conversation.memory import ConversationBufferMemory
  File "/home/s0s06c3/lang/lang_env/lib/python3.7/site-packages/langchain/chains/conversation/memory.py", line 7, in <module>
    from langchain.chains.conversation.prompt import SUMMARY_PROMPT
  File "/home/s0s06c3/lang/lang_env/lib/python3.7/site-packages/langchain/chains/conversation/prompt.py", line 2, in <module>
    from langchain.prompts.prompt import PromptTemplate
  File "/home/s0s06c3/lang/lang_env/lib/python3.7/site-packages/langchain/prompts/__init__.py", line 2, in <module>
    from langchain.prompts.base import BasePromptTemplate
  File "/home/s0s06c3/lang/lang_env/lib/python3.7/site-packages/langchain/prompts/base.py", line 35, in <module>
    class BasePromptTemplate(BaseModel, ABC):
  File "/home/s0s06c3/lang/lang_env/lib/python3.7/site-packages/langchain/prompts/base.py", line 41, in BasePromptTemplate
    @root_validator()
  File "/home/s0s06c3/lang/lang_env/lib/python3.7/site-packages/pydantic/deprecated/class_validators.py", line 231, in root_validator
    code='root-validator-pre-skip',
pydantic.errors.PydanticUserError: If you use `@root_validator` with pre=False (the default) you MUST specify `skip_on_failure=True`. Note that `@root_validator` is deprecated and should be replaced with `@model_validator`.`


I tried setting this up on my local machine as well but there also got the same issue. 

### Suggestion:

_No response_
RateLimitError
Labels: name: auto:question

### System Info

Retrying langchain.embeddings.openai.embed_with_retry.<locals>._embed_with_retry in 4.0 seconds as it raised RateLimitError: Rate limit reached for default-text-embedding-ada-002 in organization org-gvlyS3A1UcZNvf8Qch6TJZe3 on tokens per min. Limit: 150000 / min. Current: 1 / min. Contact us through our help center at help.openai.com if you continue to have issues. Please add a payment method to your account to increase your rate limit. Visit https://platform.openai.com/account/billing to add a payment method..

### 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
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import FAISS
from langchain.document_loaders import PyPDFLoader
import os


loader = PyPDFLoader("3gpp_cn/29502-i30.pdf")
pages = loader.load_and_split()
embeddings = OpenAIEmbeddings()
db = FAISS.from_documents(pages, embeddings)

db.save_local("numpy_faiss_index")


### Expected behavior

How to solve it?
DOC: The LLM type given in the Caching section is incorrect. It should be changed from ChatOpenAI to ChatGPT
Labels: name: auto:documentation

### Issue with current documentation:

During the use of ChatOpenAI, it was found that even if langchain.llm_cache=True is set, the answer is different each time for the same question, such as "What is LangChain".
 Upon tracing the source code, it was discovered that ChatOpenAI inherited BaseChatModel, which does not support the caching logic.
 If the type of LLM switched from ChatOpenAI to ChatGPT, caching will be effective. Therefore, using ChatOpenAI in the LangChain Document example is incorrect, and should be replaced with ChatGPT. The corresponding address is: https://python.langchain.com/docs/modules/model_io/models/chat/how_to/chat_model_caching.

### Idea or request for content:

It is suggested to modify the example and replace ChatOpenAI with ChatGPT.
llm = ChatGPT()
DOC: Pinecone documentation missing features
Labels: name: auto:documentation

### Issue with current documentation:

I have been working on a side project using Pinecone and discovered that there are a bunch of useful Pinecone features in Langchain that are not mentioned in Langchain's documentation. [https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/pinecone](https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/pinecone)

### Idea or request for content:

I suggest adding to the documentation to mention the other functions of Langchain's Pinecone integration. A sentence or two about the use cases of each function could also be helpful too. :+1: 

P.S. I would not mind implementing this change, would be a first good issue :)
Add String Distance and Embedding Evaluators
Labels: name: auto:enhancement

Add a string evaluator and pairwise string evaluator implementation for:
- Embedding distance
- String distance

Also updates docs:

<img width="1106" alt="image" src="https://github.com/hwchase17/langchain/assets/13333726/0a1adbbc-f72a-46c9-8280-943cc1a00502">

<img width="1035" alt="image" src="https://github.com/hwchase17/langchain/assets/13333726/f963283b-b1e9-4f66-8970-e954247253cc">
ConversationalBufferMemory is not working with my Data
Labels: name: auto:bug

### Issue you'd like to raise.

Here is my code where i use Faiss for vectorestore but it is not capable to giving a response from my pdf data where i am doing wrong please correct me.
def chat_bot_langchain():
    from langchain.llms import OpenAI
    index = faiss.read_index("faisss_audien_new.index")
    print(index)
    with open("faisss_audien_new.pkl", "rb") as f:
        store = pickle.load(f)
    store.index = index
    retriever = store.as_retriever(search_kwargs=dict(k=3))
  
    memory = ConversationBufferMemory(retriever=retriever)
    llm = OpenAI(temperature=0, max_tokens=1500, model_name='gpt-3.5-turbo')  # Can be any valid LLM
    _DEFAULT_TEMPLATE = """
                    You are having a conversation with a human your name is Kira and your age is 25 year old. Please interact naturally 
                    and avoid mentioning that you are an AI language model.\n
                    You also a human being. provides lots of specific details from its context.\n
                    


                    Relevant pieces of previous conversation:
                    {history}

                    (You do not need to use these pieces of information if not relevant)

                    Current conversation:
                    User: {input}
                    Kira AI:
                """
    PROMPT = PromptTemplate(
        input_variables=["history", "input"], template=_DEFAULT_TEMPLATE
    )
    conversation_with_summary = ConversationChain(
        llm=llm,
        prompt=PROMPT,
        memory=memory,
        verbose=True
    )
    while True:
        user_input = input("> ")

        ai_response = conversation_with_summary.predict(input=user_input)

        print("\nAssistant:\n", ai_response, "\n")
        # conversation_with_summary.predict(input="")

chat_bot_langchain()


### Suggestion:

_No response_
support adding custom  metadata to runs
Labels: name: auto:improvement

- [x] wire up tools
- [x] wire up retrievers
- [x] add integration test

<!-- 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!

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: from_documents error  
Labels: name: auto:bug

### Issue you'd like to raise.

Getting AttributeError when using chroma.from_documents
my code: db = chroma.from_documents(texts, embeddings, persist_directory=persist_directory,
    client_settings=CHROMA_SETTINGS)
AttributeError: module 'langchain.vectorstores.chroma' has no attribute 'from_documents

### Suggestion:

Please help resolve this error
ElasticKnnSearch not creating mapping correctly
Labels: name: auto:bug

### System Info

`from_texts` in `ElasticKnnSearch` is not creating a new index. 
`add_texts` is not creating the correct mapping. 

There were class instances of both these methods at one point, but they [got removed accidentally](https://github.com/hwchase17/langchain/pull/5569/commits/98f5038b1a6a6ee6f3108f95b27408ca23901724#) during some commit. 

I will add them back to the `ElasticKnnSearch` with the correct mapping and functions



### Who can help?

@jeffvea

### 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

Running
```
# Test `add_texts` method
texts = ["Hello, world!", "Machine learning is fun.", "I love Python."]
knn_search.add_texts(texts)
```
Incorrectly creates an index with dense_vector type and index:false


Running 
```
# Test `from_texts` method
new_texts = ["This is a new text.", "Elasticsearch is powerful.", "Python is fun."]
knn_search.from_texts(new_texts, dims=768)
```
throws an error about not having a keyword arg for embeddings

### Expected behavior

Correctly throw an exception when index has not been previously created. 
```
 # Test `add_texts` method
texts = ["Hello, world!", "Machine learning is fun.", "I love Python."]
knn_search.add_texts(texts)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/runner/langchain-1/langchain/vectorstores/elastic_vector_search.py", line 621, in add_texts
    raise Exception(f"The index '{self.index_name}' does not exist. If you want to create a new index while encoding texts, call 'from_texts' instead.")
Exception: The index 'knn_test_index_012' does not exist. If you want to create a new index while encoding texts, call 'from_texts' instead.
```

Correctly create new index
```
# Test `from_texts` method
new_texts = ["This is a new text.", "Elasticsearch is powerful.", "Python is fun."]
knn_search.from_texts(new_texts, dims=768)
```

The  mapping is as follows:
```
{
  "knn_test_index_012": {
    "mappings": {
      "properties": {
        "text": {
          "type": "text"
        },
        "vector": {
          "type": "dense_vector",
          "dims": 768,
          "index": true,
          "similarity": "dot_product"
        }
      }
    }
  }
}
```

Correctly index texts after index has been created

```
knn_search.add_texts(texts)
```
The agent run output parser cause error when run a simple quick start
Labels: name: auto:bug

### System Info

Langchain: 0.0.222
OS: Windows 11+WSL Ubuntu22

I run a simple test according to the agent document guide page:
https://python.langchain.com/docs/modules/agents/

I just changed the input a little bit, it throw an error about the output parser.

The code is below:
=========================
llm = langchain.chat_models.ChatOpenAI(model_name="gpt-3.5-turbo-16k-0613", temperature=0)
    tools = langchain.agents.load_tools(
        ["serpapi", "llm-math"],
        llm=llm
    )
    agentexecutor = langchain.agents.initialize_agent(
        tools=tools,
        llm=llm,
        agent=langchain.agents.AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION
    )
    results = agentexecutor.run("What is the number that the age of Donald Trump's wife in year of 2020 to power to 3?")
    print(results)

=========================

The error is below:
=========================
[chain/error] [1:RunTypeEnum.chain:AgentExecutor] [40.48s] Chain run errored with error:
"OutputParserException('Could not parse LLM output: I now know the final answer.')"
=========================
The full log file attached here.
[agent_bug20230704.log.txt](https://github.com/hwchase17/langchain/files/11943427/agent_bug20230704.log.txt)




### Who can help?

Agent

### 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
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

The code is below:
=========================
llm = langchain.chat_models.ChatOpenAI(model_name="gpt-3.5-turbo-16k-0613", temperature=0)
    tools = langchain.agents.load_tools(
        ["serpapi", "llm-math"],
        llm=llm
    )
    agentexecutor = langchain.agents.initialize_agent(
        tools=tools,
        llm=llm,
        agent=langchain.agents.AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION
    )
    results = agentexecutor.run("What is the number that the age of Donald Trump's wife in year of 2020 to power to 3?")
    print(results)

=========================

The error is below:
=========================
[chain/error] [1:RunTypeEnum.chain:AgentExecutor] [40.48s] Chain run errored with error:
"OutputParserException('Could not parse LLM output: I now know the final answer.')"

### Expected behavior

The result should be parsed properly.
Add better warnings when ref or inputs are passed but not used
Labels: name: auto:improvement

If a string evaluator doesn't want references, it currently silently ignores any that are passed in. This PR proposes to warn once if they're provided. It does so via a mixin.

Other options we could do:
- Separate classes for criteria with references and comparisons with references - I don't love this because all the combinations lead to class explosion and the class names themselves are ugly (CriteriaWithReferencesNoLabels, etc.)
- Raise errors if they're provided - I don't like this because it requires more checks when running evaluators over a dataset, but would be more explicit.
- Decide at calling time -> could be a lot of partial prompt insertions that makes it more brittle. Would make a single "run" potentially have two results that are fundamentally different evaluations