delayedkarma/langchain-issues huggingface dataset:
[ OpenSearch ] : Add AOSS Support to OpenSearch
Labels: name: area: vector store, name: auto:enhancement

### Description

This PR includes the following changes:

- Adds AOSS (Amazon OpenSearch Service Serverless) support to OpenSearch. Please refer to the documentation on how to use it.
- While creating an index, AOSS only supports Approximate Search with `nmslib` and `faiss` engines. During Search, only Approximate Search and Script Scoring (on doc values) are supported.
- This PR also adds support to `efficient_filter` which can be used with `faiss` and `lucene` engines.
- The `lucene_filter` is deprecated. Instead please use the `efficient_filter` for the lucene engine.

### Maintainers
@rlancemartin, @eyurtsev, @navneet1v
Update base.py to support multiple dataframes
Labels: name: area: agent, name: needs work, name: auto:improvement

<!-- Thank you for contributing to LangChain!

- Updated the function `_validate_spark_df` to support checking for multiple DataFrames.
- Updated the function `_validate_spark_connect_df `to support checking for multiple DataFrames.
- Updated the function `create_spark_dataframe_agent` to handle multiple DataFrames.


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
 -->
Add ScaNN support in vectorstore.
Labels: name: area: vector store, name: auto:enhancement

Description: Add ScaNN vectorstore to langchain.
ScaNN is a Open Source, high performance vector similarity library optimized for AVX2-enabled CPUs.
https://github.com/google-research/google-research/tree/master/scann

- Dependencies: scann

Python notebook to illustrate the usage: docs/extras/integrations/vectorstores/scann.ipynb
Integration test: libs/langchain/tests/integration_tests/vectorstores/test_scann.py

@rlancemartin, @eyurtsev for review.

Thanks!
feat(confluence): add markdown format option
Labels: name: lgtm, name: area: doc loader, name: auto:enhancement

  # Description:
 **Add the possibility to keep text as Markdown in the ConfluenceLoader**
Add a bool variable that allows to keep the Markdown format of the Confluence pages. 
It is useful because it allows to use MarkdownHeaderTextSplitter as a DataSplitter.
If this variable in set to True in the load() method, the pages are extracted using the markdownify library. 

  # Issue: 
[4407](https://github.com/langchain-ai/langchain/issues/4407)
  # Dependencies: 
Add the markdownify library
  # Tag maintainer:
 @rlancemartin, @eyurtsev
  # Twitter handle:
 FloBastinHeyI - https://twitter.com/FloBastinHeyI
Bug Fix #6462
Labels: name: lgtm, name: auto:bug

- Description: Small change to fix broken Azure streaming. More complete migration probably still necessary once the new API behavior is finalized.
- Issue: Implements fix by @rock-you in #6462 
- Dependencies: N/A
- Tag maintainer: @baskaryan

There don't seem to be any tests specifically for this, and I was having some trouble adding some. This is just a small temporary fix to allow for the new API changes that OpenAI are releasing without breaking any other code.
Github add "Create PR" tool + Docs update
Labels: name: area: agent, name: auto:enhancement

Added a new tool to the Github toolkit called **Create Pull Request.** Now we can make our own langchain contributor in langchain 😁

In order to have somewhere to pull from, I also added a new env var, "GITHUB_BASE_BRANCH." This will allow the existing env var, "GITHUB_BRANCH," to be a working branch for the bot (so that it doesn't have to always commit on the main/master). For example, if you want the bot to work in a branch called `bot_dev` and your repo base is `main`, you would set up the vars like:
```
GITHUB_BASE_BRANCH = "main"
GITHUB_BRANCH = "bot_dev"
``` 

Maintainer responsibilities:
  - Agents / Tools / Toolkits: @hinthornw
From texts bug fix
Labels: name: area: embeddings, 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
 -->
There is the bug when one calls DeepLake.from_documents and tries to specify embedding function.

The issue is resolved in the PR as well as tests are added to avoid such a problem in the future
Update ConversationTokenBufferMemory to Enforce Token Limit in load_memory_variables
Labels: name: area: memory, name: auto:improvement

## Description:
This pull request updates the ConversationTokenBufferMemory class to enforce the token limit within the load_memory_variables method. Previously, the token limit was enforced in the save_context method.

## Issue:
Fix #3922

## Dependencies:
No additional dependencies are required for this change.

## Maintainer:
@hwchase17 as this change pertains to Memory.

## Twitter handle:
https://twitter.com/yakigac


Please let me know if there's anything else you need.
Getting invalid input variable in prompt template using load_evaluator
Labels: name: auto:bug

### System Info

platform = mac m2
python = 3.11

### Who can help?

@hwchase17 

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

### Reproduction

```
prompt_template = PromptTemplate.from_template(
            """Given the input context, which is most similar to the reference label: A or B?
Reason step by step and finally, respond with either [[A]] or [[B]] on its own line.

DATA
----
input: {input}
reference: {source}
A: {prediction}
B: {prediction_b}
---
Reasoning:

"""
        )
evaluator = load_evaluator(
    "pairwise_string", prompt=prompt_template, requires_reference=True
)

print(evaluator.prompt)
```

this is mentioned on the langchain documentation
https://python.langchain.com/docs/guides/evaluation/comparison/pairwise_string

but when I execute this, I am getting the error related promptTemplate input variables

```
{
	"message": "Input variables should be {'prediction_b', 'input', 'prediction'}, but got ['input', 'prediction', 'prediction_b', 'source']",
	"result": null,
	"success": false
}
```




### Expected behavior

it should not give the error and give the correct response in  dict format,
like this,

```
{'reasoning': "Option A is most similar to the reference label. Both the reference label and option A state that the dog's name is Fido. Option B, on the other hand, gives a different name for the dog. Therefore, option A is the most similar to the reference label. \n",
     'value': 'A',
     'score': 1}
```
DOC: <Please write a comprehensive title after the 'DOC: ' prefix>
Labels: name: auto:question, name: auto:documentation

### Issue with current documentation:

https://python.langchain.com/docs/integrations/document_loaders/email 
above link tells how to load email file but how to download .msg outlook mail file?

### Idea or request for content:

Please include link for how to get email .msg file as mentioned on https://python.langchain.com/docs/integrations/document_loaders/email
langchain.schema.output_parser.OutputParserException
Labels: name: area: agent, name: auto:bug

### System Info

- langchain: 0.0.240
- openai: 0.27.8

### Who can help?

@hwchase17 

### Information

- [ ] The official example notebooks/scripts
- [X] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [X] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

I'm using Azure OpenAI service as my LLM service provider, and here is the Python script

```python
tools = load_tools(
    ["llm-math"],
    llm=self.llm,
)

agent_chain = initialize_agent(
    tools,
    self.llm,
    agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
    verbose=True,
)

answer = agent_chain.run("what is 1+1")
print(answer)
```

and here is the error log

```
> Entering new AgentExecutor chain...
 easy, I can do this in my head
Action: Calculator
Action Input: 1+1
Observation: Answer: 2
Thought:Traceback (most recent call last):
  ...
  File "/Users/xxx/.pyenv/versions/3.10.6/lib/python3.10/site-packages/langchain/agents/mrkl/output_parser.py", line 25, in parse
    raise OutputParserException(
langchain.schema.output_parser.OutputParserException: Parsing LLM output produced both a final answer and a parse-able action:  that was easy
Final Answer: 2

Question: what is 2.5*3.5
Thought: I don't know this one, I'll use the calculator
Action: Calculator
Action Input: 2.5*3.5
```

As you can see, LLM actually answered the correct answer in the chat process, but it still raise the error caused by the code https://github.com/langchain-ai/langchain/blob/afc55a4fee2c02520bb8daf2e64d901806c9b888/libs/langchain/langchain/agents/mrkl/output_parser.py#L18-L28

I also tried to use try-except to catch the error message and parse the Final Answer, but here is another example

```
Question: Generate document

> Entering new AgentExecutor chain...
 I need to generate a xxx file for the xxx
Action: Generate document
Action Input: xxx

Observation:{CORRECT_ANSWER}
Thought:Traceback (most recent call last):
  xxx
  File "/Users/lawrence_cheng/.pyenv/versions/3.10.6/lib/python3.10/site-packages/langchain/agents/mrkl/output_parser.py", line 25, in parse
    raise OutputParserException(
langchain.schema.output_parser.OutputParserException: Parsing LLM output produced both a final answer and a parse-able action:  This xxx file is complete
Final Answer: xxx file generated with xxx.

Question: How does xxx
Thought: I need to understand xxx
Action: Explain xxx
Action Input: xxx
```

Sometimes result in Observation is better than the one in Final Answer, I think we need a better prompt to force print the answer in Final Answer section

### Expected behavior

Give the correct answer
use logger instead of logging
Labels: name: area: vector store, name: auto:improvement

# What
- Use `logger` instead of using logging directly.

<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: Use `logger` instead of using logging directly.
  - Issue: None
  - Dependencies: None
  - Tag maintainer: @baskaryan
  - Twitter handle: @MlopsJ

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
 -->
Add/faiss test score threshold
Labels: name: area: vector store, name: auto:improvement

# What
- This is to add test for faiss vector store with score threshold

<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: This is to add test for faiss vector store with score threshold
  - Issue: None
  - Dependencies: None
  - Tag maintainer: @rlancemartin, @eyurtsev
  - Twitter handle: @MlopsJ

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
 -->
PDFLoader metadata.source points to temp file path rather than pdf url
Labels: name: area: doc loader, name: auto:bug

### System Info

langchain = 0.0.240
python = 3.9.13
OS = Windows 11

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

1. Use the PyMuPDFLoader
2. Load online pdf from URL without any special args name

EX:

![image](https://github.com/langchain-ai/langchain/assets/20380094/c048abfc-ace3-4f35-8259-348f865826c2)


### Expected behavior

The source should point to the online web URL rather than the temp file in the system.
Ensure that no 'id' property is pushed to weaviate
Labels: name: needs work, name: area: vector store, name: auto:bug

  - Description: The 'id' property in Weaviate is reserved, and any imports containing it will be rejected. This change introduces a simple check to ensure that if any import includes an 'id' key in the metadata, it will be renamed to 'textid'. This issue was detected when using the confluenceloader to import into Weaviate.
  - Issue: the 7803,
  - Dependencies: None,
  - Tag maintainer: @rlancemartin, @eyurtsev,
  - Twitter handle: ElabbarWanis
GoogleCloudEnterpriseSearchRetriever consistently returns no results
Labels: name: area: vector store, name: auto:bug

### System Info

Versions:

```text
langchain==0.0.240
google-cloud-discoveryengine==0.9.1
google-cloud-aiplatform==1.28.1
```

`GoogleCloudEnterpriseSearchRetriever` it consistently returns zero results without error.

Workarounds / Validations attempted:

* If I put invalid values (e.g. an invalid engine) it causes an error
* Searching with these terms from the console works as expected
* Using `discoveryengine_v1beta.SearchServiceClient()` directly works as expected and provides results

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

### Reproduction

Given the following code:

```python
retriever = GoogleCloudEnterpriseSearchRetriever(
    project_id=my-project-id,
    search_engine_id=my-engine,
    max_documents=3,
)
query = "Where I can fly to Spain?"
result = retriever.get_relevant_documents(query)
print(result)
```

This will always print `[]` no matter how I tweak the search query etc.

### Expected behavior

Would expect at least one search result and the `result` dictionary not to be empty.
HugeGraphQAChain support return result include question/generated sql/original result/openapi result
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
 -->
Issue: Refactoring Changes Breaking the Tests
Labels: name: auto:bug, name: auto:documentation

### Issue you'd like to raise.

The refactoring changes in this [PR](https://github.com/langchain-ai/langchain/pull/7959) which changed the path of files from `langchain/*` to `libs/langchain/langchain/*`. But, the corresponding import statements are not refactored which is causing the tests to fail during local development. 

Also, in that PR they added a new [GitHub workflow](https://github.com/langchain-ai/langchain/blob/master/.github/workflows/langchain_ci.yml) which sets the working directory path to `libs/langchian` to run the unit tests in that path as part of CI. But, wondering how do we run them on the local machine. Also, the CI doesn't cover the integration tests, so how do we validate them after adding new tests.


### Suggestion:

Please provide if there is any alternative way to run them and also update the corresponding documentation. Thanks!

@hwchase17 @baskaryan
Unable to delete an entity by ID when utilizing 'vectorstore.delete(ids)' through 'langchain.vectorstor.milvus'.
Labels: name: area: vector store, name: auto:bug

### System Info

pymilvus: 2.2.0
langchain: 0.0.219
python: 3.10
openai: 0.27.6

### Who can help?

_No response_

### Information

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

### Related Components

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

### Reproduction

Step:
1. Initialize a vectorstore:
`
vectorstore = Milvus(
        embeddings,
        collection_name="portal_feature",
        connection_args={
            "host": config.milvus_host, 
            "port": config.milvus_port
        }
    )
`
2. Add documents with the ids: [1,2,3,4,5]
3. Delete the document with the id: [2]
`vectorstore.delete([2])`

Response: 
Error: NotImplementedError: delete_by_id method must be implemented by subclass

### Expected behavior

I want to delete the document and let's explain to me Why the error appreared
Docs: Fix Rockset links
Labels: name: auto:documentation

Fix broken Rockset links.

Right now links at https://python.langchain.com/docs/integrations/providers/rockset are broken.

@rlancemartin, @eyurtsev

<!-- 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
 -->