Commit Graph

11290 Commits (44791ce131a68014ab2523105eb7602b1539018c)
 

Author SHA1 Message Date
Bagatur d19e074374
core[patch]: handle serializable fields that cant be converted to bool (#25903) 3 weeks ago
Kirushikesh DB 7f857a02d5
docs: HuggingFace pipeline returns the prompt if return_full_text is not set (#25916)
Thank you for contributing to LangChain!

**Description:**
The current documentation of using the Huggingface with Langchain needs
to set return_full_text as False otherwise pipeline by default returns
both the prompt and response as output.


Code to reproduce:
```python
from langchain_huggingface import ChatHuggingFace, HuggingFacePipeline
from langchain_core.messages import (
    HumanMessage,
    SystemMessage,
)

llm = HuggingFacePipeline.from_model_id(
    model_id="microsoft/Phi-3.5-mini-instruct",
    task="text-generation",
    pipeline_kwargs=dict(
        max_new_tokens=512,
        do_sample=False,
        repetition_penalty=1.03,
        # return_full_text=False
    ),
    device=0
)

chat_model = ChatHuggingFace(llm=llm)

messages = [
    SystemMessage(content="You're a helpful assistant"),
    HumanMessage(
        content="What happens when an unstoppable force meets an immovable object?"
    ),
]

ai_msg = chat_model.invoke(messages)
print(ai_msg.content)
```
Output:
```
<|system|>
You're a helpful assistant<|end|>
<|user|>
What happens when an unstoppable force meets an immovable object?<|end|>
<|assistant|>
 The scenario of an "unstoppable force" meeting an "immovable object" is a classic paradox that has puzzled philosophers, scientists, and thinkers for centuries. In physics, however, there are no such things as truly unstoppable forces or immovable objects because all physical entities have mass and interact with other masses through fundamental forces (like gravity).

When we consider the laws of motion, particularly Newton's third law which states that for every action, there is an equal and opposite reaction, it becomes clear that if one were to exist, the other would necessarily be negated by the interaction. For example, if you push against a solid wall with great force, the wall exerts an equal and opposite force back on you, preventing your movement.

In theoretical discussions, this paradox often serves as a thought experiment to explore concepts like determinism versus free will, the limits of physical laws, and the nature of reality itself. However, in practical terms, any force applied to an object will result in some form of deformation, transfer of energy, or movement, depending on the properties of both the force and the object.

So while the idea of an unstoppable force and an immovable object remains a fascinating philosophical conundrum, it does not hold up under the scrutiny of physical laws as we understand them.
```

---------

Co-authored-by: Kirushikesh D B kirushi@ibm.com <kirushi@cccxl012.pok.ibm.com>
3 weeks ago
Yuxi Zheng 38dfde6946
docs: fix typo in Cassandra for ./cookbook/cql_agent.ipynb (#25922)
Thank you for contributing to LangChain!

- [ ] **PR title**: "package: description"
- Where "package" is whichever of langchain, community, core,
experimental, etc. is being modified. Use "docs: ..." for purely docs
changes, "templates: ..." for template changes, "infra: ..." for CI
changes.
  - Example: "community: add foobar LLM"


- [ ] **PR message**: ***Delete this entire checklist*** and replace
with
    - **Description:** a description of the change
    - **Issue:** the issue # it fixes, if applicable
    - **Dependencies:** any dependencies required for this change
- **Twitter handle:** if your PR gets announced, and you'd like a
mention, we'll gladly shout you out!


- [ ] **Add tests and docs**: 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.


- [ ] **Lint and test**: Run `make format`, `make lint` and `make test`
from the root of the package(s) you've modified. See contribution
guidelines for more: https://python.langchain.com/docs/contributing/

Additional guidelines:
- Make sure optional dependencies are imported within a function.
- Please do not add dependencies to pyproject.toml files (even optional
ones) unless they are required for unit tests.
- Most PRs should not touch more than one package.
- Changes should be backwards compatible.
- If you are adding something to community, do not re-import it in
langchain.

If no one reviews your PR within a few days, please @-mention one of
baskaryan, efriis, eyurtsev, ccurme, vbarda, hwchase17.

Co-authored-by: “syd” <“zheng.yuxi@outlook.com>
3 weeks ago
Borahm Lee 9cdb99bd60
docs: remove unused imports in Tutorials Basics (#25919)
## Description

- `List` is not explicitly used, so the unnecessary imports will be
removed.
3 weeks ago
Erick Friis 8732cfc6ef
docs: review process gh discussion (#25921) 3 weeks ago
Erick Friis 08b9715845
docs: pr review process (#25899)
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
3 weeks ago
ccurme 60054db1c4
infra[patch]: remove together from scheduled tests (#25909)
These now run in https://github.com/langchain-ai/langchain-together
3 weeks ago
Emmanuel Leroy 654da27255
improve llamacpp embeddings (#12972)
- **Description:**
Improve llamacpp embedding class by adding the `device` parameter so it
can be passed to the model and used with `gpu`, `cpu` or Apple metal
(`mps`).
Improve performance by making use of the bulk client api to compute
embeddings in batches.
  
  - **Dependencies:** none
  - **Tag maintainer:** 
@hwchase17

---------

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
Co-authored-by: Chester Curme <chester.curme@gmail.com>
3 weeks ago
Sandeep Bhandari f882824eac
Update tool_choice.ipynb spelling mistake of select (#25907)
Thank you for contributing to LangChain!

- [ ] **PR title**: "package: description"
- Where "package" is whichever of langchain, community, core,
experimental, etc. is being modified. Use "docs: ..." for purely docs
changes, "templates: ..." for template changes, "infra: ..." for CI
changes.
  - Example: "community: add foobar LLM"


- [ ] **PR message**: ***Delete this entire checklist*** and replace
with
    - **Description:** a description of the change
    - **Issue:** the issue # it fixes, if applicable
    - **Dependencies:** any dependencies required for this change
- **Twitter handle:** if your PR gets announced, and you'd like a
mention, we'll gladly shout you out!


- [ ] **Add tests and docs**: 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.


- [ ] **Lint and test**: Run `make format`, `make lint` and `make test`
from the root of the package(s) you've modified. See contribution
guidelines for more: https://python.langchain.com/docs/contributing/

Additional guidelines:
- Make sure optional dependencies are imported within a function.
- Please do not add dependencies to pyproject.toml files (even optional
ones) unless they are required for unit tests.
- Most PRs should not touch more than one package.
- Changes should be backwards compatible.
- If you are adding something to community, do not re-import it in
langchain.

If no one reviews your PR within a few days, please @-mention one of
baskaryan, efriis, eyurtsev, ccurme, vbarda, hwchase17.
3 weeks ago
ℍ𝕠𝕝𝕝𝕠𝕨 𝕄𝕒𝕟 64b62f6ae4
community[neo4j_vector]: make embedding dimension check optional (#25737)
**Description:**

Starting from Neo4j 5.23 (22 August 2024), with vector-2.0 indexes,
`vector.dimensions` is not required to be set, which will cause it the
key not exist error in index config if it's not set.

Since the existence of vector.dimensions will only ensure additional
checks, this commit turns embedding dimension check optional, and only
do checks when it exists (not None).

https://neo4j.com/release-notes/database/neo4j-5/

**Twitter handle:** @HollowM186

Signed-off-by: Hollow Man <hollowman@opensuse.org>
Co-authored-by: Erick Friis <erick@langchain.dev>
3 weeks ago
Christophe Bornet 0a752a74cc
community[patch], docs: Add API reference doc for GraphVectorStore (#25751) 3 weeks ago
Bagatur 28e2ec7603
ollama[patch]: Release 0.1.3 (#25902) 3 weeks ago
Bagatur ca1c3bd9c0
community[patch]: bump + fix core dep (#25901) 3 weeks ago
Bagatur fabe32c06d
core[patch]: Release 0.2.37 (#25900) 3 weeks ago
Richmond Alake 9992a1db43
cookbook: AI Agent Built With LangChain and FireWorksAI (#22609)
Thank you for contributing to LangChain!

- **AI Agent Built With LangChain and FireWorksAI**: "community
notebook"
- **Description:** Added a new AI agent in the cookbook folder that
integrates prompt compression using LLMLingua and arXiv retrieval tools.
The agent is designed to optimize the efficiency and performance of
research tasks by compressing lengthy prompts and retrieving relevant
academic papers. The agent also makes uses of MongoDB to store
conversational history and as it's knowledge base using MongoDB vector
store
    - **Twitter handle:** https://x.com/richmondalake

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
Co-authored-by: Bagatur <baskaryan@gmail.com>
3 weeks ago
mehdiosa c6f00e6bdc
community: Fix branch not being considered when using GithubFileLoader (#20075)
- **Description:** Added `ref` query parameter so data is not loaded
only from the default branch but any branch passed

---------

Co-authored-by: Osama Mehdi <mehdi@hm.edu>
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
3 weeks ago
Leonid Ganeline 54d2b861f6
docs: `integrations` reference updates 12 (#25676)
Added missed provider pages and links. Fixed inconsistent formatting.

Co-authored-by: Erick Friis <erick@langchain.dev>
3 weeks ago
Aditya c8b1c3a7e7
docs: update documentation for Vertex Embeddings Models (#25745)
- **Description:update documentation for Vertex Embeddings Models
    - **Issue:NA
    - **Dependencies:NA
    - **Twitter handle:NA

---------

Co-authored-by: adityarane@google.com <adityarane@google.com>
3 weeks ago
Alex Sherstinsky 617a4e617b
community: Fix a bug in handling kwargs overwrites in Predibase integration, and update the documentation. (#25893)
Thank you for contributing to LangChain!

- [x] **PR title**: "package: description"
- Where "package" is whichever of langchain, community, core,
experimental, etc. is being modified. Use "docs: ..." for purely docs
changes, "templates: ..." for template changes, "infra: ..." for CI
changes.
  - Example: "community: add foobar LLM"


- [x] **PR message**: ***Delete this entire checklist*** and replace
with
    - **Description:** a description of the change
    - **Issue:** the issue # it fixes, if applicable
    - **Dependencies:** any dependencies required for this change
- **Twitter handle:** if your PR gets announced, and you'd like a
mention, we'll gladly shout you out!


- [x] **Add tests and docs**: 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.


- [x] **Lint and test**: Run `make format`, `make lint` and `make test`
from the root of the package(s) you've modified. See contribution
guidelines for more: https://python.langchain.com/docs/contributing/

Additional guidelines:
- Make sure optional dependencies are imported within a function.
- Please do not add dependencies to pyproject.toml files (even optional
ones) unless they are required for unit tests.
- Most PRs should not touch more than one package.
- Changes should be backwards compatible.
- If you are adding something to community, do not re-import it in
langchain.

If no one reviews your PR within a few days, please @-mention one of
baskaryan, efriis, eyurtsev, ccurme, vbarda, hwchase17.
3 weeks ago
Erick Friis 28f6ff6fcd
docs: remove incorrect vectorstore local column (#25895) 3 weeks ago
Anush ade4bfdff1
qdrant: Updated class check in Self-Query Retriever factory (#25877)
## Description

- Updates the self-query retriever factory to check for the new Qdrant
vector store class. i.e. `langchain_qdrant.QdrantVectorstore`.
- Deprecates `QdrantSparseVectorRetriever`, since the vector store
implementation natively supports it now.

Resolves #25798
3 weeks ago
Djordje 862ef32fdc
community: Fixed infinity embeddings async request (#25882)
**Description:** Fix async infinity embeddings
**Issue:** #24942  

@baskaryan, @ccurme
3 weeks ago
rainsubtime f75d5621e2
community:Fix a bug of LLM in moonshot (#25878)
- **Description:** When useing LLM integration moonshot,it's occurring
error "'Moonshot' object has no attribute '_client'",it's because of the
"_client" that is private in pydantic v1.0 so that we can't use it.I
turn "_client" into "client" , the error to be resolved!
- **Issue:** the issue #24390 
- **Dependencies:** none
- **Twitter handle:** @Rainsubtime




- [x] **Lint and test**: Run `make format`, `make lint` and `make test`
from the root of the package(s) you've modified. See contribution
guidelines for more: https://python.langchain.com/docs/contributing/

Co-authored-by: Cyue <Cyue_work2001@163.com>
3 weeks ago
ZhangShenao fd0f147df3
Improvement[Community] Add tool-calling test case for `ChatZhipuAI` (#25884)
- Add tool-calling test case for `ChatZhipuAI`
3 weeks ago
k.muto 5bb810c5c6
docs: updated args_schema to be required when using callback handlers in custom tools. (#25887)
- **Description:** if you use callback handlers when using tool,
run_manager will be added to input, so you need to explicitly specify
args_schema, but i was confused because it was not listed, so i added
it. Also, it seems that the type does not work with pydantic.BaseModel.
- **Issue:** None
- **Dependencies:** None
3 weeks ago
默奕 6377185291
add neo4j query constructor for self query (#25288)
- [x] **PR title - community: add neo4j query constructor for self
query**

- [x] **PR message**
- **Description:** adding a Neo4jTranslator so that the Neo4j vector
database can use SelfQueryRetriever
    - **Issue:** this issue had been raised before in #19748
    - **Dependencies:** none. 
    - **Twitter handle:** @moyi_dang
- p.s. I have not added the query constructor in BUILTIN_TRANSLATORS in
this PR, I want to make changes to only one package at a time.

- [x] **Add tests and docs**: 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.


- [x] **Lint and test**: Run `make format`, `make lint` and `make test`
from the root of the package(s) you've modified. See contribution
guidelines for more: https://python.langchain.com/docs/contributing/

Additional guidelines:
- Make sure optional dependencies are imported within a function.
- Please do not add dependencies to pyproject.toml files (even optional
ones) unless they are required for unit tests.
- Most PRs should not touch more than one package.
- Changes should be backwards compatible.
- If you are adding something to community, do not re-import it in
langchain.

If no one reviews your PR within a few days, please @-mention one of
baskaryan, efriis, eyurtsev, ccurme, vbarda, hwchase17.

---------

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: Chester Curme <chester.curme@gmail.com>
3 weeks ago
Ohad Eytan b5d670498f
partners/milvus: allow creating a vectorstore with sparse embeddings (#25284)
# Description
Milvus (and `pymilvus`) recently added the option to use [sparse
vectors](https://milvus.io/docs/sparse_vector.md#Sparse-Vector) with
appropriate search methods (e.g., `SPARSE_INVERTED_INDEX`) and
embeddings (e.g., `BM25`, `SPLADE`).

This PR allow creating a vector store using langchain's `Milvus` class,
setting the matching vector field type to `DataType.SPARSE_FLOAT_VECTOR`
and the default index type to `SPARSE_INVERTED_INDEX`.

It is only extending functionality, and backward compatible. 

## Note
I also interested in extending the Milvus class further to support multi
vector search (aka hybrid search). Will be happy to discuss that. See
[here](https://github.com/langchain-ai/langchain/discussions/19955),
[here](https://github.com/langchain-ai/langchain/pull/20375), and
[here](https://github.com/langchain-ai/langchain/discussions/22886)
similar needs.

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
3 weeks ago
Erick Friis 09b04c7e3b
"community: release 0.2.15" (#25867) 3 weeks ago
Erick Friis f7e62754a1
community: undo azure_ad_access_token breaking change (#25818) 3 weeks ago
Leonid Ganeline 6047138379
docs: `arxiv` reference updates (#24949)
Added: arxiv references to the concepts page.
Regenerated: arxiv references page.
Improved: formatting of the concepts page (moved the Partner packages
section after langchain_community)
3 weeks ago
Bagatur 1759ff5836
infra: rm together lagnchain test dp (#25866) 3 weeks ago
Erick Friis 24f0c232fe
docs: elastic feature (#25865) 3 weeks ago
Erick Friis 1640872059
together: mv to external repo (#25863) 3 weeks ago
Michael Paciullo e7c856c298
langchain_openai: Add "strict" parameter to OpenAIFunctionsAgent (#25862)
- **Description:** OpenAI recently introduced a "strict" parameter for
[structured outputs in their
API](https://openai.com/index/introducing-structured-outputs-in-the-api/).
An optional `strict` parameter has been added to
`create_openai_functions_agent()` and `create_openai_tools_agent()` so
developers can use this feature in those agents.

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
3 weeks ago
Bagatur fabd3295fa
core[patch]: dont mutate merged lists/dicts (#25858)
Update merging utils to
- not mutate objects
- have special handling to 'type' keys in dicts
3 weeks ago
Kyle Winkelman 09c2d8faca
langchain_openai: Cleanup OpenAIEmbeddings validate_environment. (#25855)
**Description:** [This portion of
code](https://github.com/langchain-ai/langchain/blob/v0.1.16/libs/partners/openai/langchain_openai/embeddings/base.py#L189-L196)
has no use as a couple lines later a [`ValueError` is
thrown](https://github.com/langchain-ai/langchain/blob/v0.1.16/libs/partners/openai/langchain_openai/embeddings/base.py#L209-L213).
**Issue:** A follow up to #25852.
3 weeks ago
Kyle Winkelman 201bdf7148
community: Cap AzureOpenAIEmbeddings chunk_size at 2048 instead of 16. (#25852)
**Description:** Within AzureOpenAIEmbeddings there is a validation to
cap `chunk_size` at 16. The value of 16 is either an old limitation or
was erroneously chosen. I have checked all of the `preview` and `stable`
releases to ensure that the `embeddings` endpoint can handle 2048
entries
[Azure/azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference).
I have also found many locations that confirm this limit should be 2048:
-
https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#embeddings
-
https://learn.microsoft.com/en-us/azure/ai-services/openai/quotas-limits

**Issue:** fixes #25462
3 weeks ago
Leonid Ganeline 08c9c683a7
docs: `integrations` reference updates 6 (#25188)
Added missed provider pages. Added missed references to the integration
components.
3 weeks ago
Allan Ascencio a8af396a82
added octoai test (#21793)
- [ ] **PR title**: community: add tests for ChatOctoAI

- [ ] **PR message**: 
Description: Added unit tests for the ChatOctoAI class in the community
package to ensure proper validation and default values. These tests
verify the correct initialization of fields, the handling of missing
required parameters, and the proper setting of aliases.
Issue: N/A
Dependencies: None

---------

Co-authored-by: ccurme <chester.curme@gmail.com>
Co-authored-by: Eugene Yurtsev <eugene@langchain.dev>
3 weeks ago
Param Singh 69f9acb60f
premai[patch]: Standardize premai params (#21513)
Thank you for contributing to LangChain!

community:premai[patch]: standardize init args

- updated `temperature` with Pydantic Field, updated the unit test.
- updated `max_tokens` with Pydantic Field, updated the unit test.
- updated `max_retries` with Pydantic Field, updated the unit test.

Related to #20085

---------

Co-authored-by: Isaac Francisco <78627776+isahers1@users.noreply.github.com>
Co-authored-by: ccurme <chester.curme@gmail.com>
3 weeks ago
Guangdong Liu fcf9230257
community(sparkllm): Add function call support in Sparkllm chat model. (#20607)
- **Description:** Add function call support in Sparkllm chat model.
Related documents
https://www.xfyun.cn/doc/spark/Web.html#_2-function-call%E8%AF%B4%E6%98%8E
- @baskaryan

---------

Co-authored-by: ccurme <chester.curme@gmail.com>
3 weeks ago
ChengZi 37f5ba416e
partners[milvus]: fix issue when metadata_schema is None (#25836)
fix issue when metadata_schema is None

Signed-off-by: ChengZi <chen.zhang@zilliz.com>
3 weeks ago
ccurme 426333ff6f
infra[patch]: remove AI21 from scheduled tests (#25847)
These now run in https://github.com/langchain-ai/langchain-ai21
3 weeks ago
Jorge Piedrahita Ortiz 9ac953a948
Community: sambastudio embeddings GenericV2 API support (#25064)
- **Description:** 
        SambaStudio GenericV2 API support 
        Minor changes for requests error handling
3 weeks ago
Sam Jove bdce9a47d0
community[patch]: callback before yield for _astream (gigachat) (#25834)
Description: Moves yield to after callback for _astream for gigachat in
the community package
Issue: #16913

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
3 weeks ago
Jinoos Lee 703af9ffe3
Patch enable to use Amazon OpenSearch Serverless(aoss) for Semantic Cache store (#25833)
- [x] **PR title**: "community: Patch enable to use Amazon OpenSearch
Serverless for Semantic Cache store"

- [x] **PR message**: 
- **Description:** OpenSearchSemanticCache class support Amazon
OpenSearch Serverless for Semantic Cache store, it's only required to
pass auth(http_auth) parameter to initializer
    - **Dependencies:** none

If no one reviews your PR within a few days, please @-mention one of
baskaryan, efriis, eyurtsev, ccurme, vbarda, hwchase17.

---------

Co-authored-by: Jinoos Lee <jinoos@amazon.com>
3 weeks ago
William FH 1ad621120d
docs: Update langgraph 0.2.0 checkpointer import path (#25205)
And fix the description for timeout
3 weeks ago
Andrew Benton c410545075
docs: add self-hosting row to code interpreter tools table (#25303)
**Description:** Add information about self-hosting support to the code
interpreter tools table.
**Issue:** N/A
**Dependencies:** N/A
3 weeks ago
Eugene Yurtsev 83327ac43a
docs: Fix typo in openai llm integration notebook (#25492)
Fix typo in openai LLM integration notebook.
3 weeks ago
Leonid Ganeline 31f55781b3
docs: added ColBERT reference (#25452)
Added references to the source papers.
Fixed URL verification code.
Improved arXive page formatting.
Regenerated arXiv page.
3 weeks ago