delayedkarma/langchain-issues huggingface dataset:
CypherQueryCorrector cannot validate a correct cypher, some query types are not handled
Labels: name: auto:bug, name: auto:improvement, name: area: models

CypherQueryCorrector does not handle with some query types:

If there is such a query (There is a comma in the match between clauses): 

```
MATCH (a:APPLE {apple_id: 123})-[:IN]->(b:BUCKET), (ba:BANANA {name: banana1})
``` 

Corresponding code section: 
- It extract a relation between BUCKET and BANANA, however there is none.
- ELSE case should be divided into cases. (INCOMING relation, OUTGOING relation, BIDIRECTIONAL relation, NO relation etc.)
- IF there is no relation and only a comma between clauses, then it should not try validation.

https://github.com/langchain-ai/langchain/blob/751226e067bc54a70910763c0eebb34544aaf47c/libs/langchain/langchain/chains/graph_qa/cypher_utils.py#L228
add mongodb_store
Labels: name: area: vector store, name: auto:enhancement, name: size:L

# Add MongoDB storage
  - **Description:** 
  Add MongoDB Storage as an option for large doc store. 

Example usage: 
```Python
# Instantiate the MongodbStore with a MongoDB connection
from langchain.storage import MongodbStore

mongo_conn_str = "mongodb://localhost:27017/"
mongodb_store = MongodbStore(mongo_conn_str, db_name="test-db",
                                collection_name="test-collection")

# Set values for keys
doc1 = Document(page_content='test1')
doc2 = Document(page_content='test2')
mongodb_store.mset([("key1", doc1), ("key2", doc2)])

# Get values for keys
values = mongodb_store.mget(["key1", "key2"])
# [doc1, doc2]

# Iterate over keys
for key in mongodb_store.yield_keys():
    print(key)

# Delete keys
mongodb_store.mdelete(["key1", "key2"])
 ```

  - **Dependencies:**
  Use `mongomock` for integration test.
community: fix qianfan chat stream calling caused exception
Labels: name: lgtm, name: auto:bug, name: area: models, name: size:L

  - **Description:** 
`QianfanChatEndpoint`  extends `BaseChatModel` as a super class, which has a default stream implement might concat the MessageChunk with `__add__`. When call stream(), a ValueError for duplicated key will be raise.
  - **Issues:** 
     * #13546  
     * #13548
     * merge two single test file related to qianfan.
  - **Dependencies:** no
  - **Tag maintainer:**
Issue:Handle IndexError for Empty Document Lists - Display Default Value or Message
Labels: name: area: doc loader, name: auto:bug, name: auto:improvement

### Issue you'd like to raise.

    
Encountered IndexError in the code due to an attempt to access a list index that is out of range. This issue occurs when there are no documents available, resulting in the deletion of all embeddings. To handle this case gracefully, consider implementing a mechanism to display a default value or a meaningful message when there are no documents present. The specific line causing the error is:

```python
source = relevant_document[0].metadata['source']


### Suggestion:

_No response_
Remove save function for ChatPromptTemplate
Labels: name: auto:bug, name: area: models, name: size:XS

<!-- 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.
 -->

Fixes https://github.com/langchain-ai/langchain/issues/13794
Feat: MLFlow callback allow passing `nested` param
Labels: name: auto:improvement

### Feature request

Currently when initilizing the `MlflowCallbackHandler`, we can pass in name, experiment, tracking_uri. But couldn't pass in the `nested` param. 

### Motivation

It would be nice if we can do that, so that when there are multiple chains running, we can nest those runs under one parent run, making it easier to group them for later on monitor/debug.

### Your contribution

I tried to edit the mlflow_callback.py and add the nested option, but it doesn't seem to honor the value.
Please let me know if you know how to make this work and I'm happy to put up a PR. Thanks!
ChatPromptTemplate save method not implemented
Labels: name: auto:bug, name: area: models

### System Info

master branch

### Who can help?

@hwchase17

### Information

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

### Related Components

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

### Reproduction

https://github.com/langchain-ai/langchain/blob/751226e067bc54a70910763c0eebb34544aaf47c/libs/core/langchain_core/prompts/chat.py#L653-L659

ChatPromptTemplate override save method as NotImplementedError, while the base class `BasePromptTemplate` has a default implementation of `save` method https://github.com/langchain-ai/langchain/blob/751226e067bc54a70910763c0eebb34544aaf47c/libs/core/langchain_core/prompts/base.py#L157-L192. It should just depend on the implementation of `_prompt_type` property, where ChatPromptTemplate already implemented here https://github.com/langchain-ai/langchain/blob/751226e067bc54a70910763c0eebb34544aaf47c/libs/core/langchain_core/prompts/chat.py#L648-L651.

If removing the override save function, ChatPromptTemplate could be saved correctly. 

### Expected behavior

We should be able to save ChatPromptTemplate object into a file.
Issue: please assist me in removing myself from the Discord blacklist.
Labels: name: auto:question

### Issue you'd like to raise.

it seems my discord account has been hacked, so it auto send advertisement like below, and i thought it was official ads just like telegram and the ads only show to me, so I don't pay attention to it.
<img width="503" alt="image" src="https://github.com/langchain-ai/langchain/assets/1664952/8a048285-bd18-408e-9a31-0d2c57e1ef17">
Now i can't join discord server as expect.
I have enable 2FA and change my password, so could your please assist me in removing myself from the Discord blacklist. my account id is "h3l1221", thanks a low .


### Suggestion:

_No response_
Mac nov23
Labels: name: auto:documentation, name: size:XXL

<!-- 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.
 -->
bump 0.0.339rc2
Labels: name: auto:nit, name: size:S

<!-- 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.
 -->
Astra DB vector store, move constructor docstring to class docstring
Labels: name: lgtm, name: area: vector store, name: auto:documentation, name: size:M

This PR rearranges the docstring for the `AstraDB` vector store class so as to have all useful information in the _class_ docstring for ease of reading.

(incidentally, due to an oversight, the docstring that was in the constructor ended up buried below some lines of code, thereby disappearing altogether from accessibility. Apologies.)
How to add json_object to ChatOpenAI class?
Labels: name: auto:question, name: area: models

### Issue you'd like to raise.

How can I add the new parameter **JSON MODE** ( https://platform.openai.com/docs/guides/text-generation/json-mode )
to this snippet of code?
```python
from langchain.chat_models import ChatOpenAI
llm = ChatOpenAI(
            model_name="gpt-3.5-turbo-1106",
            temperature=1,
            max_tokens=None
)
```

I see in openai it should be used in this way:
```python
response = client.chat.completions.create(
  model="gpt-3.5-turbo-1106",
  response_format={ "type": "json_object" },
  messages=[
    {"role": "system", "content": "You are a helpful assistant designed to output JSON."},
    {"role": "user", "content": "Who won the world series in 2020?"}
  ]
)
```

Thanks!!


### Suggestion:

_No response_
Support auth header, when underlying client support it.
Labels: name: auto:improvement, name: area: models

### Feature request

Support auth token headers in langchain, when underlying model supports it.

### Motivation

I'd like to use ChatAnthropic, but I'm using a custom proxy backend, where I need to provide Authorization header.
This is simple using AnthropicClient directly as it accepts auth_token parameter.

Problem is, langchain ChatAnthropic abstraction, doesn't accept this param.
It would be great to have an option to pass auth_token to model, when model supports it.

### Your contribution

I don't feel comfortable in this codebase to create a PR
AstraDB VectorStore: implement pre_delete_collection
Labels: name: lgtm, name: area: vector store, name: auto:improvement, name: size:L

  - **Description:** some vector stores have a flag for try deleting the collection before creating it (such as ´vectorpg´). This is a useful flag when prototyping indexing pipelines and also for integration tests. Added the bool flag `pre_delete_collection ` to the constructor (default False) 
  - **Tag maintainer:** @hemidactylus 
  - **Twitter handle:** nicoloboschi
Issue: how to access to cached question and answer in InMemoryCache
Labels: name: area: memory, name: auto:question, name: auto:improvement

### Issue you'd like to raise.

InMemoryCache works, but it doesn't print to stderr like all other LLM responses. I checked logs and response is stored. I don't know how to access to this stored values...

### Suggestion:

option to view object or option to return values.
DOC: Simplify CONTRIBUTING.md by removing conda and pip references
Labels: name: area: doc loader, name: auto:documentation

### Issue with current documentation:

if "our goal is to have the simplest developer setup possible", we shouldn't encourage mixing poetry with the use of conda and pip in [CONTRIBUTING.md](https://github.com/langchain-ai/langchain/blob/5ae51a8a85d1a37ea98afeaf639a72ac74a50523/.github/CONTRIBUTING.md). Mixing different tools for the same job is error prone and leads to confusion for new contributors. 

Specifically, the following lines should be reconsidered:

❗Note: Before installing Poetry, if you use Conda, create and activate a new Conda env (e.g. conda create -n langchain python=3.9) ([link](https://github.com/langchain-ai/langchain/blob/5ae51a8a85d1a37ea98afeaf639a72ac74a50523/.github/CONTRIBUTING.md#:~:text=%E2%9D%97Note%3A%20Before%20installing%20Poetry%2C%20if%20you%20use%20Conda%2C%20create%20and%20activate%20a%20new%20Conda%20env%20(e.g.%20conda%20create%20%2Dn%20langchain%20python%3D3.9)))

❗Note: If you use Conda or Pyenv as your environment/package manager, after installing Poetry, tell Poetry to use the virtualenv python environment (poetry config virtualenvs.prefer-active-python true) ([link](https://github.com/langchain-ai/langchain/blob/5ae51a8a85d1a37ea98afeaf639a72ac74a50523/.github/CONTRIBUTING.md#:~:text=%E2%9D%97Note%3A%20If%20you%20use%20Conda%20or%20Pyenv%20as%20your%20environment/package%20manager%2C%20after%20installing%20Poetry%2C%20tell%20Poetry%20to%20use%20the%20virtualenv%20python%20environment%20(poetry%20config%20virtualenvs.prefer%2Dactive%2Dpython%20true)))

If the tests don't pass, you may need to pip install additional dependencies, such as numexpr and openapi_schema_pydantic. ([link](https://github.com/langchain-ai/langchain/blob/5ae51a8a85d1a37ea98afeaf639a72ac74a50523/.github/CONTRIBUTING.md#:~:text=If%20the%20tests%20don%27t%20pass%2C%20you%20may%20need%20to%20pip%20install%20additional%20dependencies%2C%20such%20as%20numexpr%20and%20openapi_schema_pydantic.))








### Idea or request for content:

_No response_
Issue: Conversational retrieval chain, response_if_no_docs_found not working
Labels: name: auto:bug, name: auto:question, name: area: models

### Issue you'd like to raise.

It stated in the docs that there's a parameter called response_if_no_docs_found, which If specified, the chain will return a fixed response if no docs 
    are found for the question.

I have tried it and asked another person, who says they tried it and it doesn't work, 
how do i get it to work
because its a very important aspect

### Suggestion:

_No response_
JSON response support for Ollama
Labels: name: auto:enhancement, name: area: models

### Feature request

JS LangChain (https://js.langchain.com/docs/integrations/chat/ollama_functions) supports Ollama Functions and allows to return JSON output from Ollama. It would be good to have the same functionality in Python LangChain.

### Motivation

JSON response from LangChain Ollama would be very useful, when integrating LangChain into API pipelines running on local environments

### Your contribution

I could test the implementation.
Repair Wikipedia document loader `load_max_docs` and improve test coverage.
Labels: name: lgtm, name: area: doc loader, name: auto:bug, name: size:M

**Description:** 

Repair Wikipedia document loader `load_max_docs` and improve test coverage.

**Issue:** 

The Wikipedia document loader was not respecting the `load_max_docs` paramater (not reported) and would always return a maximum of 10 documents. This is because the API wrapper (in `utilities/wikipedia.py`) wasn't passing `top_k_results` to the underlying [Wikipedia library](https://wikipedia.readthedocs.io/en/latest/code.html#module-wikipedia). By default this library returns 10 results.

The default number of results for the document loader has been reduced from 100 to 25. This is because loading 100 results takes a very long time and is an inconvenient default. It should possibly be 10.

In addition, the documentation for the loader reported that there was a hard limit (300) on the number of documents returned. In actuality 300 is the maximum Wikipedia query character length set by the API wrapper.

Tests have been added for the document loader (previously missing) and to test the correct numbers of documents are being returned by each class, both by default, and when overridden. Also repaired is the `assert_docs` test which has been updated to correctly test for the default metadata (which includes `source` in recent releases).

**Dependencies:** 
nil

**Tag maintainer:**
@leo-gan

**Twitter handle:**
@queenvictoria
Fix Azure Openai function calling in streaming mode
Labels: name: lgtm, name: auto:bug, name: area: models, name: size:S

- **Description**: This PR addresses an issue with the OpenAI API streaming response, where initially the key (arguments) is provided but the value is None. Subsequently, it updates with {"arguments": "{\n"}, leading to a type inconsistency that causes an exception. The specific error encountered is ValueError: additional_kwargs["arguments"] already exists in this message, but with a different type. This change aims to resolve this inconsistency and ensure smooth API interactions.
- **Issue**: None.
- **Dependencies**: None.
- **Tag maintainer**: @eyurtsev

This is an updated version of #13229 based on the refactored code. Credit goes to @superken01.
Update Hologres vector store: use hologres-vector
Labels: name: area: vector store, name: auto:improvement, name: size:L

Hi,
I made some code changes on the Hologres vector store to improve the data insertion performance.
Also, this version of the code uses `hologres-vector` library. This library is more convenient for us to update, and more efficient in performance.
The code has passed the format/lint/spell check. I have run the unit test for Hologres connecting to my own database.
Please check this PR again and tell me if anything needs to change.

Best,
Changgeng,
Developer @ Alibaba Cloud
_TextGenerationModel.predict() got an unexpected keyword argument 'functions'Issue: <Please write a comprehensive title after the 'Issue: ' prefix>
Labels: name: area: vector store, name: auto:bug, name: area: models, name: integration: chroma

### Issue you'd like to raise.

I  am trying to create a vertex ai and langchain based entity extraction program. I have stored my documents in form of vector embeddings in chromadb. I have been trying to extract the attributes/features like name, price, etc but whenever i run chains I'm getting this error. 

### Suggestion:

_No response_
Update agents\conversational\output_parser.py
Labels: name: area: agent, name: auto:bug, name: size:XS

The regular expression  regex = r"Action: (.*?)[\n]*Action Input: (.*)", with .* being the default greedy match.This results in the action_input variable not including the part after the newline character.

<!-- 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.
 -->
Changing Model Param after Initialization VLLM Model
Labels: name: auto:improvement, name: area: models

### Feature request

Introduce a more flexible method to specify model parameters directly within the LLMChain or VLLM method, allowing users to modify these parameters without creating a new model instance each time.

### Motivation

Currently, when utilizing the Langchain library's VLLM class, modifying model parameters (such as temperature, top_k, top_p, etc.) requires creating a new instance of the VLLM class. This process becomes cumbersome, especially when frequent adjustments to model parameters are necessary.
Current Situation:
`
from langchain.llms import VLLM

llm = VLLM(
    model="mosaicml/mpt-7b",
    trust_remote_code=True,  # mandatory for hf models
    max_new_tokens=128,
    top_k=10,
    top_p=0.95,
    temperature=0.8,
)

template = """Question: {question}

Answer: Let's think step by step."""
prompt = PromptTemplate(template=template, input_variables=["question"])

llm_chain = LLMChain(prompt=prompt, llm=llm)

question = "Who was the US president in the year the first Pokemon game was released?"

print(llm_chain.run(question))


`

It is very tedious to keep creating new model when i want to change model params like (temperature and etc) .

In naive VLLM, this can be done so easily:
llm = LLM(model="qwen/Qwen-7B-Chat", revision="v1.1.8", trust_remote_code=True)
outputs = llm.generate(prompts, model_params)
outputs = llm.generate(prompts, model_params)


### Your contribution

NA
RFC: Serialization tests
Labels: name: auto:improvement, name: size:XXL

<!-- 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.
 -->