delayedkarma/langchain-issues huggingface dataset:
How can I embed chat logs into the specified collection 'QDRANT_COLLECTION_NAME' in Qrdant, and what approach should I use to write the chain for short-term memory?
Labels: name: area: embeddings, name: auto:question

### Issue with current documentation:

import os
import qdrant_client
from dotenv import load_dotenv
from langchain.chains import RetrievalQA
from langchain.embeddings.huggingface import HuggingFaceInstructEmbeddings
from langchain.llms import OpenAI
from langchain.vectorstores import Qdrant

os.environ['OPENAI_API_KEY'] = "mykey"


# memory=
def get_vector_store():
    client = qdrant_client.QdrantClient(
        os.getenv('QDRANT_HOST'),
    )

    embeddings = HuggingFaceInstructEmbeddings(model_name="all-MiniLM-L6-v2")
    vector_store = Qdrant(
        client=client,
        collection_name=os.getenv('QDRANT_COLLECTION_NAME'),
        embeddings=embeddings,
    )

    return vector_store


def main():
    load_dotenv()
    vectorstore = get_vector_store()

    qa = RetrievalQA.from_chain_type(
        llm=OpenAI(
            temperature=0.7,
            max_tokens=100,
        ),
        chain_type="stuff",
        retriever=vectorstore.as_retriever(search_type="similarity_score_threshold",
                                           search_kwargs={"score_threshold": 0.1})
    )

    while True:
        user_question = input("ask:")
        if user_question == "bye":
            break
        answer = qa.invoke(user_question)
        print(f"Ai: {answer}")


if __name__ == "__main__":
    main()


### Idea or request for content:

How can I embed chat logs into the specified collection 'QDRANT_COLLECTION_NAME' in Qrdant, and what approach should I use to write the chain for short-term memory?
langchain-community: LanceDB integration improvements/fixes
Labels: name: area: vector store, name: auto:improvement, name: size:L

Hi, I'm from the LanceDB team.

Improves LanceDB integration by making it easier to use - now you aren't required to create tables manually and pass them in the constructor, although that is still backward compatible.

Bug fix - pandas was being used even though it's not a dependency for LanceDB or langchain

PS - this issue was raised a few months ago but lost traction. It is a feature improvement for our users kindly review this , Thanks !
community: New documents loader for visio files (with extension .vsdx)
Labels: name: area: doc loader, name: auto:enhancement, name: size:XL

**Description** : New documents loader for visio files (with extension .vsdx)

A [visio file](https://fr.wikipedia.org/wiki/Microsoft_Visio) (with extension .vsdx) is associated with Microsoft Visio, a diagram creation software. It stores information about the structure, layout, and graphical elements of a diagram. This format facilitates the creation and sharing of visualizations in areas such as business, engineering, and computer science.

A Visio file can contain multiple pages. Some of them may serve as the background for others, and this can occur across multiple layers. This loader extracts the textual content from each page and its associated pages, enabling the extraction of all visible text from each page, similar to what an OCR algorithm would do.

**Dependencies** : xmltodict package
No file/folder found for package langchain-monorepo
Labels: name: auto:bug

### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.

### Example Code

none

### Description

In the HOME directory of the langchain source code, execute the following command:
poetry install --with lint,typing,test

However, the following errors are thrown, and I have a few questions to ask:
(1) Why do we need to perform a downgrade operation on modules like langchain-core, and how to avoid downgrading?
(2) Why can't the module langchain-monorepo be found?
(3) How to compile the source code of langchain in order to understand the principles of langchain and contribute code to langchain?

My development environment:
Python: Built on conda, Python version 3.8.18
Langchain: The master branch on GitHub.

Error message:


(langchain) [xiaobai@xiaobai langchain-master]$ poetry install --with lint,typing,test
Installing dependencies from lock file

Package operations: 0 installs, 4 updates, 0 removals

  • Downgrading langchain-core (0.1.10 /home/xiaobai/data/pro/python/langchain-master/libs/core -> 0.1.3 /home/xiaobai/data/pro/python/langchain-master/libs/core)
  • Downgrading langchain-community (0.0.12 /home/xiaobai/data/pro/python/langchain-master/libs/community -> 0.0.6 /home/xiaobai/data/pro/python/langchain-master/libs/community)
  • Downgrading langchain (0.1.0 /home/xiaobai/data/pro/python/langchain-master/libs/langchain -> 0.0.352 /home/xiaobai/data/pro/python/langchain-master/libs/langchain)
  • Downgrading langchain-experimental (0.0.49 /home/xiaobai/data/pro/python/langchain-master/libs/experimental -> 0.0.47 /home/xiaobai/data/pro/python/langchain-master/libs/experimental)

Installing the current project: langchain-monorepo (0.0.1)
The current project could not be installed: No file/folder found for package langchain-monorepo
If you do not want to install the current project use --no-root



### System Info

Python: Built on conda, Python version 3.8.18
Langchain: The master branch on GitHub.

### 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
Bagatur/sql use case

<!-- Thank you for contributing to LangChain!

Please title your PR "<package>: <description>", where <package> is whichever of langchain, community, core, experimental, etc. is being modified.

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,
  - **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` from the root of the package you've modified to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://python.langchain.com/docs/contributing/

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/docs/integrations` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Update readme
Labels: name: auto:documentation, name: size:M

<!-- Thank you for contributing to LangChain!

Please title your PR "<package>: <description>", where <package> is whichever of langchain, community, core, experimental, etc. is being modified.

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,
  - **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` from the root of the package you've modified to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://python.langchain.com/docs/contributing/

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/docs/integrations` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Geopandas and Langchain blocking issue. 
Labels: name: auto:bug, name: area: langserve

### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.

### Example Code

The bug was found by trying to install [jupyter-ai](https://github.com/jupyterlab/jupyter-ai) via conda-forge. 
```install -c conda-forge jupyter_ai```

Basically, there is an incompatibility with the latest version of langchain and geopandas. 


### Description

Based on the bug report posted on the jupyter-ai github https://github.com/jupyterlab/jupyter-ai/issues/557#issue-2062998660 , it looks like langchain enforces a version of geopandas below 0.14. Could this be relaxed to allow for >0.14? There are many features of modern geopandas that make GIS workflows so much easier, and the current enforcement version  prevents langchain-dependent repositories from making full use of GIS-adjacent stacks.  

### System Info

The incompatibility arose while using an M1 apple silicon laptop. 

### 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
Dependency issues with Spark toolkit examples
Labels: name: area: agent, name: auto:bug

### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.

### Example Code

```
 pip install langchain langchain-community langchain-core langchain-experimental
```

```
from langchain.agents import create_spark_sql_agent
from langchain_community.agent_toolkits import SparkSQLToolkit
from langchain_community.utilities.spark_sql import SparkSQL
from langchain_openai import ChatOpenAI
from pyspark.sql import SparkSession
```


### Description

I get errors related to dependicies when trying to follow the Spark toolkit examples from the documentation.

For example:
https://python.langchain.com/docs/integrations/toolkits/spark_sql

```
ImportError: cannot import name 'TypeAliasType' from 'typing_extensions' (/databricks/python/lib/python3.10/site-packages/typing_extensions.py)
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
File <command-2000110168240505>, line 1
----> 1 from langchain.agents import create_spark_sql_agent
      2 from langchain_community.agent_toolkits import SparkSQLToolkit
      3 from langchain_community.utilities.spark_sql import SparkSQL

File /local_disk0/.ephemeral_nfs/envs/pythonEnv-b2a0b64a-b43b-40f8-a165-ff3aac48e3b4/lib/python3.10/site-packages/langchain/agents/__init__.py:34
     31 from pathlib import Path
     32 from typing import Any
---> 34 from langchain_community.agent_toolkits import (
     35     create_json_agent,
     36     create_openapi_agent,
     37     create_pbi_agent,
     38     create_pbi_chat_agent,
     39     create_spark_sql_agent,
     40     create_sql_agent,
     41 )
     42 from langchain_core._api.path import as_import_path
     44 from langchain.agents.agent import (
     45     Agent,
     
     ```

### System Info

langchain==0.1.1
langchain-community==0.0.13
langchain-core==0.1.11
langchain-experimental==0.0.49

Python 3.10

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [X] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async
Inference Component Name header is required  (SageMaker RedShift Flan T5)
Labels: name: auto:bug, name: area: models, name: integration: aws

### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.

### Example Code

llm = SagemakerEndpoint(
    endpoint_name=endpoint_name,
    endpoint_kwargs={ "CustomAttributes": "accept_eula=true,InferenceComponentName="+inference_component_name }, 
    region_name = region_name,
    
    credentials_profile_name = profile_name,
    model_kwargs = parameters,
    content_handler = content_handler,

)
print(str( llm.endpoint_kwargs ))

db = SQLDatabase.from_uri(REDSHIFT_ENDPOINT)

db_chain = SQLDatabaseSequentialChain.from_llm(
    llm, db, verbose=True, use_query_checker=True
)
try:
    results = db_chain.run(QUESTION_01)
    print(results)
except (ProgrammingError, ValueError, DataError) as exc:
    print(f"\n\n{exc}")

### Description

I am using a Sagemaker Flan T5 Xl model to ask  model and is ok, 
but when try to use langchain to query RedShift DB.
I have this error.
----> " Error raised by inference endpoint: An error occurred (ValidationError) when calling the InvokeEndpoint operation: Inference Component Name header is required for endpoints to which you plan to deploy inference components. Please include Inference Component Name header or consider using SageMaker models."

### System Info

model jumpstart-dft-hf-text2text-flan-t5 xxl
Python 3.11.6
boto3 1.34.19
langchain 0.1.0
langchain-community 0.0.12
langchain-core 0.1.10
langchain-experimental 0.0.49
sentence-transformers 2.2.2
SQLAlchemy 1.4.48

### 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
Update gradient.ipynb
Labels: name: auto:documentation, name: size:XS

Enviroment -> Environment

<!-- Thank you for contributing to LangChain!

Please title your PR "<package>: <description>", where <package> is whichever of langchain, community, core, experimental, etc. is being modified.

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,
  - **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` from the root of the package you've modified to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://python.langchain.com/docs/contributing/

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/docs/integrations` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Missing unpack operator for or_clause in pgvector document filter
Labels: name: area: vector store, name: auto:bug

### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.

### Example Code

The following code: 

```
from langchain.vectorstores import PGVector

filter = {
    "source": {
        "or": [{"contains": "xlsx"}, {"contains": "pdf"}]
    }
}
vector_db = PGVector(connection_string=connection_string, embedding_function=embeddings)
vector_db.as_retriever(search_type="similarity", search_kwargs={"k": 5, "filter": filter})
```

won't work because the list is not unpacked when passed to
filter_by_metadata = sqlalchemy.or_(or_clauses) in https://github.com/langchain-ai/langchain/blob/e5cf1e2414a22c7465f0f47bd661ece183e88924/libs/community/langchain_community/vectorstores/pgvector.py#L548

The code throws the error
`ArgumentError: SQL expression for WHERE/HAVING role expected, got [, ].`

### Description

* I am trying to filter documents based on metadata during retrieval
* I want to pass a list to filter metadata via an "or" statement.
* I think it should be `filter_by_metadata = sqlalchemy.or_(*or_clauses)` in https://github.com/langchain-ai/langchain/blob/e5cf1e2414a22c7465f0f47bd661ece183e88924/libs/community/langchain_community/vectorstores/pgvector.py#L548

### System Info

langchain==0.0.353
langchain-community==0.0.13
langchain-core==0.1.11

Python 3.10.13

### 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
DOC: No documentation about QAGenerationChain in langchain.evaluation.qa
Labels: name: auto:documentation, name: area: models

### Issue with current documentation:

This is no documentation about QAGenerationChain in langchain.evaluation.qa 
I used `from langchain.evaluation.qa import QAGenerateChain` to run evaluation using LLM-generated examples. 

I tried to find documentation regarding the QAGenerateChain and found none. 

Even in [api.python.langchain.com/](https://api.python.langchain.com/en/latest/search.html?q=QAGenerationChain#) site there is documentation regarding `langchain.chains.qa_generation.base.QAGenerationChain` but nothing about `from langchain.evaluation.qa import QAGenerateChain` 



### Idea or request for content:

I believe there is more work that needs to be done. Please fill a documentation or a use case of `QAGenerateChain`
i want to add OutputFixingParser in LCEL chain
Labels: name: auto:enhancement, name: area: lcel

### Feature request

like 

from langchain.output_parsers import OutputFixingParser
fix_parser = OutputFixingParser.from_llm(llm, parser)
chain= chat_template | llm | parser |fix_parser


### Motivation

I think OutputFixing should be in the process of generating content in a specific format.

### Your contribution

I'm sorry.
ElasticsearchStore does not accept proxy
Labels: name: area: vector store, name: auto:improvement, name: integration: elasticsearch

### Feature request

We should be able to pass some extra parameters to `ElasticsearchStore` in form of kwargs or predefined parameters.
For example, to allow usage of `RequestsHttpNode` that takes `https_proxy` / `http_proxy` / `no_proxy` env variables.





### Motivation

In some cases, all the external calls to internet/ELK (on cloud) must use a proxy, else it will be rejected by the firewall of the company.
The default behavior of `Elasticsearch` class from https://github.com/elastic/elasticsearch-py does not take by default proxy env variable and you need to set a `node_class` to `RequestsHttpNode`


### Your contribution

Instead of calling `ElasticsearchStore` from langchain, I duplicated locally the file and hardcoded in the `Elasticsearch` init the `node_class`.

``` python
from elastic_transport import RequestsHttpNodes

# https://github.com/langchain-ai/langchain/blob/e5cf1e2414a22c7465f0f47bd661ece183e88924/libs/community/langchain_community/vectorstores/elasticsearch.py#L593

es_client = elasticsearch.Elasticsearch(
    **connection_params,
    node_class=RequestsHttpNode,
    headers={"user-agent": ElasticsearchStore.get_user_agent()},
)
```

I am sure there's a better way and more global way to pass parameters to `Elasticsearch()`
Implement vector length definition at init time in PGVector for indexing
Labels: name: area: vector store, name: auto:improvement

### Feature request

Allow manual definition of embedding column length in PGVector

### Motivation

Right now embeddings stores in PGVector are initialised with:
`embedding: Vector = sqlalchemy.Column(Vector(None))`
This won't allow indexing of the DB ([https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/howto-optimize-performance-pgvector](url))

### Your contribution

I can open a PR shortly to fix it
DOC: Dead link in langgraph docs
Labels: name: auto:documentation

### Issue with current documentation:

https://python.langchain.com/docs/langgraph 

The paragraph under "Examples":

> 
> Modifications
> 
> We also have a lot of examples highlighting how to slightly modify the base chat agent executor. These all build off the [getting started notebook](https://python.langchain.com/docs/examples/chat_agent_executor_with_function_calling/base.ipynb) so it is recommended you start with that first.

The link is not working.

### Idea or request for content:

_No response_
SQLDatabase.from_uri Throws an error when used with Vertica
Labels: name: area: agent, name: auto:bug

### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.

### Example Code

```
    db = SQLDatabase.from_uri(
        'vertica+vertica_python://user:pwd@x.x.x.x:5433/verticadst',
        schema='myschema'
    )
```


### Description

When I use the above snippet to create an SQLDatabase object for vertica, I get the below error:

> sqlalchemy.exc.ProgrammingError: (vertica_python.errors.MissingSchema) Severity: ERROR, Message: Schema "pg_catalog" does not exist

Which makes sense because Vertica does not have pg_catalog schema, but how can I create the object without the reflect part where it tries to read from pg_catalog

### System Info

sqlalchemy-vertica-python~=0.6.3
langchain==0.1.0

### Related Components

- [X] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [X] Agents / Agent Executors
- [ ] Tools / Toolkits
- [X] Chains
- [ ] Callbacks/Tracing
- [ ] Async
langchain_community: Replace azure_cosmos_db_vector_search with azure_cosmos_db in Cosmos DB Documentation
Labels: name: lgtm, name: area: vector store, name: auto:documentation, name: size:XS

**Description**: This PR fixes an error in the documentation for Azure Cosmos DB Integration. 
**Issue**: The correct way to import `AzureCosmosDBVectorSearch` is
```python
from langchain_community.vectorstores.azure_cosmos_db import (
    AzureCosmosDBVectorSearch,
)
```
While the [documentation](https://python.langchain.com/docs/integrations/vectorstores/azure_cosmos_db) states it to be
```python
from langchain_community.vectorstores.azure_cosmos_db_vector_search import (
    AzureCosmosDBVectorSearch,
    CosmosDBSimilarityType,
)
```
As you can see in [azure_cosmos_db.py](https://github.com/langchain-ai/langchain/blob/c323742f4fda30e8bef5381f41f66192afb2b9d2/libs/langchain/langchain/vectorstores/azure_cosmos_db.py#L1C45-L2)
**Dependencies:**: None
**Twitter handle**: None