delayedkarma/langchain-issues huggingface dataset:
Remove useless line of code from sql.ipynb
Labels: name: auto:documentation

This PR remove a single line of code from a notebook of the documentation. This line used to define a variable, which is never used in the code.
For further context, for reviewers, here is the online documentation: https://python.langchain.com/docs/use_cases/qa_structured/sql#case-3-sql-agents

<!-- Thank you for contributing to LangChain!

Replace this entire 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 your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

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. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
DOC: Links at the bottom of Plan and Execute Agents blog do not work
Labels: name: area: doc loader, name: auto:documentation

### Issue with current documentation:

https://blog.langchain.dev/plan-and-execute-agents/

Links at the end of the Conclusion section do not work.

[here (Python)](https://python.langchain.com/docs/modules/agents/agent_types/plan_and_execute?ref=blog.langchain.dev
) and [here (JS)](https://js.langchain.com/docs/modules/agents/agents/examples/plan_and_execute_agent?ref=blog.langchain.dev) are broken.

### Idea or request for content:

_No response_
Finished chain - None, when I run an csv_agent on a csv file. 
Labels: name: area: agent, name: auto:bug, name: area: models

### Issue you'd like to raise.

My openai llm see to run fine but some how not getting the answer in Finished chain. 


Model used

```
def llm_function(csv_file_name):

    agent = create_csv_agent(
        ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613", request_timeout=120),
        csv_file_name,
        verbose=True,
        agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
    )

    # Pass a query to the chain
    query = QUESTION
    query = query + " using tool python_repl_ast"
    #response = agent.run(query)

    try:
        response = agent.run(query)
    except ValueError as e:
        response = str(e)
        if not response.startswith("Could not parse LLM output: `"):
            raise e
        response = response.removeprefix("Could not parse LLM output: `").removesuffix("`")
        return response
```

Results

```
> Entering new AgentExecutor chain...
Thought: To find the least expensive product, I need to sort the dataframe by the "Price" column in ascending order and then select the first row.

Action: python_repl_ast
Action Input: df.sort_values("Price").head(1)

Observation:                             Product Name  Price        Price per Count   Bought Last Month
296  MAGNESIUM PHOSPHORICUM 6C 30 ML SBL     90  Price_count not found  Data not available
Thought:The least expensive product is "MAGNESIUM PHOSPHORICUM 6C 30 ML SBL" with a price of 90.
Final Answer: "MAGNESIUM PHOSPHORICUM 6C 30 ML SBL"

> Finished chain.
None
```

### Suggestion:

_No response_
Langchain connects Neo4j v5.9 error Could not use APOC procedures
Labels: name: auto:bug

### System Info

I have successfully installed the apoc plugin by pressing the neo4j document, and run ` return apoc.version() ` on the neo4j client to return successfully. 
However, when Neo4jGraph was used in Langchain connection, errors were still reported.
```
ValueError: Could not use APOC procedures. Please ensure the APOC plugin is installed in Neo4j and that 'apoc.meta.data()' is allowed in Neo4j configuration 
```

### 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.graphs import Neo4jGraph

graph = Neo4jGraph(
    'bolt://localhost:7687',
    'neo4j',
    'chenhuabc'
)

print(graph)

# ValueError: Could not use APOC procedures. Please ensure the APOC plugin is installed in Neo4j and that 'apoc.meta.data()' is allowed in Neo4j configuration 


### Expected behavior

I have successfully installed the apoc plugin by pressing the neo4j document, and run ` return apoc.version() ` on the neo4j client to return successfully. 
However, when Neo4jGraph was used in Langchain connection, errors were still reported.
```
ValueError: Could not use APOC procedures. Please ensure the APOC plugin is installed in Neo4j and that 'apoc.meta.data()' is allowed in Neo4j configuration 
```
Encounter KeyError: 'user_agent' while using CohereRerank()
Labels: name: area: vector store, name: auto:bug, name: area: models

### System Info

langchain==0.0.330
Python 3.10.12

### Who can help?

@hwchase17

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

### Reproduction

from langchain.retrievers import ContextualCompressionRetriever
from langchain.retrievers.document_compressors import CohereRerank

#
compressor = CohereRerank()
#

Error Encountered
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
[<ipython-input-29-be190c4da94f>](https://localhost:8080/#) in <cell line: 5>()
      3 
      4 #
----> 5 compressor = CohereRerank()
      6 #
      7 compression_retriever = ContextualCompressionRetriever(

2 frames
/usr/local/lib/python3.10/dist-packages/pydantic/main.cpython-310-x86_64-linux-gnu.so in pydantic.main.BaseModel.__init__()

/usr/local/lib/python3.10/dist-packages/pydantic/main.cpython-310-x86_64-linux-gnu.so in pydantic.main.validate_model()

[/usr/local/lib/python3.10/dist-packages/langchain/retrievers/document_compressors/cohere_rerank.py](https://localhost:8080/#) in validate_environment(cls, values)
     53             values, "cohere_api_key", "COHERE_API_KEY"
     54         )
---> 55         client_name = values["user_agent"]
     56         values["client"] = cohere.Client(cohere_api_key, client_name=client_name)
     57         return values

KeyError: 'user_agent'

### Expected behavior

The below error should not have been encountered as the COHERE API Key has alreday been set and cohere.Client() is workin with the api key provided


---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
[<ipython-input-29-be190c4da94f>](https://localhost:8080/#) in <cell line: 5>()
      3 
      4 #
----> 5 compressor = CohereRerank()
      6 #
      7 compression_retriever = ContextualCompressionRetriever(

2 frames
/usr/local/lib/python3.10/dist-packages/pydantic/main.cpython-310-x86_64-linux-gnu.so in pydantic.main.BaseModel.__init__()

/usr/local/lib/python3.10/dist-packages/pydantic/main.cpython-310-x86_64-linux-gnu.so in pydantic.main.validate_model()

[/usr/local/lib/python3.10/dist-packages/langchain/retrievers/document_compressors/cohere_rerank.py](https://localhost:8080/#) in validate_environment(cls, values)
     53             values, "cohere_api_key", "COHERE_API_KEY"
     54         )
---> 55         client_name = values["user_agent"]
     56         values["client"] = cohere.Client(cohere_api_key, client_name=client_name)
     57         return values

KeyError: 'user_agent'
LLMChain does not stream
Labels: name: auto:bug, name: auto:improvement, name: area: models

### System Info

Platform: macOS Sonoma 14.0
Python Version: 3.11
LangChain Version: 0.0.330

### Who can help?



@agola11 

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

### Reproduction

```python
prompt = PromptTemplate.from_template("What is a good name for a company that makes {product}?")
chain = LLMChain(llm=llm, prompt=prompt)

for chunk in chain.stream({ "product": "colorful socks" })
    print(f"Chunk: {chunk}")
```

### Expected behavior

One expects to receive chunks when streaming, but because the `stream` method is not implemented in the `LLMChain class`, it falls back to the `stream` method in the base `Chain` class. This results in a `chunk` variable containing the full response.

This can be fixed easily by something like this.

```python
from langchain.chains import LLMChain

class MyChain(LLMChain):
    def stream(
            self,
            input: Input,
            config: Optional[RunnableConfig] = None,
            run_manager: Optional[CallbackManagerForChainRun] = None,
            **kwargs: Optional[Any],
    ) -> Iterator[Output]:
        prompts, stop = self.prep_prompts([input], run_manager=run_manager)
        yield from self.llm.stream(input=prompts[0], config=config, **kwargs)

```

```python
prompt = PromptTemplate.from_template("What is a good name for a company that makes {product}?")
chain = MyChain(llm=llm, prompt=prompt)

for chunk in chain.stream({ "product": "colorful socks" })
    print(f"Chunk: {chunk}") ✅
```

If you agree, I would like to create PR which will fix that.
DOC: Typo under docs for using chat models for ReAct agents
Labels: name: area: doc loader, name: auto:documentation

### Issue with current documentation:

Page link: https://python.langchain.com/docs/modules/agents/agent_types/react#using-chat-models

Under "Using chat models", second paragraph: 

```The main difference here is a different prompt. We will use JSON to encode the agent's actions (chat models are a bit tougher to steet, so using JSON helps to enforce the output format).```

_steet_ should be replaced with _steer_.

### Idea or request for content:

_No response_
Fix configurable for non-hashable options
Labels: name: auto:bug



<!-- Thank you for contributing to LangChain!

Replace this entire 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 your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

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. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Update tool description on uploaded and removed file
Labels: name: auto:improvement, name: area: models

For the llm to work properly with the tool, it needs context of the current files. This seems little bit hackish, so if you have better approach, let me know! 

<!-- Thank you for contributing to LangChain!

Replace this entire 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 your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

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. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Adding LLMEncodedChainExtractor
Labels: name: auto:enhancement, name: area: models, name: template, name: size:XXL, name: partner

**Description:** Adding an optimized version of the `LLMChainExtractor` called `LLMEncodedChainExtractor` that uses an encoding technique to fetch only the indices of the relevant sequence instead of having the LLM regenerate the sequence verbatim. Unit and integration tests have been added. There is also a demo notebook that compares `LLMEncodedChainExtractor` to the `LLMChainExtractor`
**Dependencies:** Optional dependencies - `spacy^3.7.2` and the `en_core_web_sm-3.7.0` model.
 **Tag maintainer:** @hwchase17
Update return type for Runnable.__or__
Labels: name: auto:improvement

<!-- Thank you for contributing to LangChain!

Replace this entire 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 your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

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. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Issue: <getting error in create_structured_output_chain prefix>
Labels: name: auto:bug, name: area: models

### Issue you'd like to raise.

lass Node(BaseModel):
    problem:str=Field(...,description="the problem related to fan")
    causes:List[str]=Field(...,description="causes related to particular problem")
    component:Dict[str,str]=Field(...,description='key should be component of fan and value should be description of how component is getting affected')


    # description:list[list[str]]=Field(...,description="description for all the causes mentioned)

class Final(BaseModel):
    final:List[Node]=Field(...,description="list of all the Node types")

this is my pydantic class , and i am trying to get structure output from the llm

error is 
  pydantic_args = self.pydantic_schema.parse_raw(_result)  # type: ignore
  File "pydantic\main.py", line 549, in pydantic.main.BaseModel.parse_raw
  File "pydantic\main.py", line 526, in pydantic.main.BaseModel.parse_obj
  File "pydantic\main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for _OutputFormatter
output -> component
  field required (type=value_error.missing)

### Suggestion:

_No response_
Update csv.ipynb description
Labels: name: lgtm, name: auto:documentation

The line removed is not required as there are no other alternative solutions above than that.

<!-- Thank you for contributing to LangChain!

Replace this entire 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 your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

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. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Cohere embeddings API error . Doesnot work with its new v3 model
Labels: name: area: embeddings, name: auto:bug

### System Info

Cohere embeddings v3 model requires a input_type parameter . This is specific to the new models as per cohere API doc. as follows

input_type
string
Specifies the type of input you're giving to the model. Not required for older versions of the embedding models (i.e. anything lower than v3), but is required for more recent versions (i.e. anything bigger than v2).
https://docs.cohere.com/reference/embed

When I try specifying the the new cohere v3 embeddings model in Langchain, I get the following error 
![image](https://github.com/langchain-ai/langchain/assets/431890/15de1db1-3610-47d2-837c-9826ba5b47d9)

This needs to be addressed / fixed.



### Who can help?

_No response_

### Information

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

### Related Components

- [ ] LLMs/Chat Models
- [X] 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 import CohereEmbeddings
cohere_api_key = "xxxx"   #Get your API key from www.cohere.com
embeddings = CohereEmbeddings(model="embed-english-v3.0",cohere_api_key=cohere_api_key)

### Expected behavior

Embeddings with cohere v3 should work.
Update get_message.py
Labels: name: auto:improvement

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
    updated the libs/langchain/langchain/tools/gmail/get_message.py 
  - **Issue:** the issue # it fixes (if applicable),
    to enable reading html opts as well
  - **Dependencies:** any dependencies required for this change,
    imported re
  - **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 your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

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. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
added Templates/rag lancedb example
Labels: name: area: vector store, name: auto:enhancement


  - **Description:** a description of the change, 
  i wanted to add lancedb as vectordb , I saw there are other vectordb  but not lancedb so i added code for it 
  - **Dependencies:** any dependencies required for this change,
   pip install lancedb ,
  which i already added in the poetry

please review this pr
fix: load google credentials properly in GoogleDriveLoader
Labels: name: area: doc loader, name: auto:bug


- **Description:** 
	- Fix #12870: set scope in `default` func (ref: https://google-auth.readthedocs.io/en/master/reference/google.auth.html)
	- Moved the code to load default credentials to the bottom for clarity of the logic
	- Add docstring and comment for each credential loading logic
- **Issue:** https://github.com/langchain-ai/langchain/issues/12870
- **Dependencies:** no dependencies change
- **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
- **Twitter handle:** @gymnstcs

<!-- If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->