Commit Graph

11843 Commits

Author SHA1 Message Date
ccurme
b631b0a596
community[patch]: cap SQLAlchemy and update deps (#27792)
SQLAlchemy 2.0.36 introduces a regression when creating a table in
DuckDB.

Relevant issues:
- In SQLAlchemy repo (resolution is to update DuckDB):
https://github.com/sqlalchemy/sqlalchemy/discussions/12011
- In DuckDB repo (PR is open):
https://github.com/Mause/duckdb_engine/issues/1128

Plan is to track these issues and remove cap when resolved.
2024-10-31 14:19:09 +00:00
Erick Friis
8ad7adad87
infra: build api docs from package listing (#27774) 2024-10-30 21:31:01 -07:00
JiaranI
3952ee31b8
ollama: add pydocstyle linting for ollama (#27686)
Description: add lint docstrings for ollama module
Issue: the issue https://github.com/langchain-ai/langchain/issues/23188
@baskaryan

test: ruff check passed.
<img width="311" alt="e94c68ffa93dd518297a95a93de5217"
src="https://github.com/user-attachments/assets/e96bf721-e0e3-44de-a50e-206603de398e">

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-10-31 03:06:55 +00:00
Aayush Kataria
a8a33b2dc6
LangChain-Community - AzureCosmos Mongo vCore: Bug Fix when the data doesn't contain metadata field (#27772)
Thank you for contributing to LangChain!
- **Description:** Adding an empty metadata field when metadata is not
present in the data
- **Issue:** This PR fixes the issue when the data items doesn't contain
the metadata field. This happens when there is already data in the
container, or cx uses CosmosDB Python SDK to insert data.
- **Dependencies:** No dependencies required

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.
2024-10-30 20:05:25 -07:00
Rave Harpaz
8d8d85379f
community: OCI Generative AI tool calling bug fix (#26910)
- [x] **PR title**: 
  "community: OCI Generative AI tool calling bug fix 


- [x] **PR message**: 
- **Description:** bug fix for streaming chat responses with tool calls.
Update to PR 24693
    - **Issue:** chat response content is repeated when streaming
    - **Dependencies:** NA
    - **Twitter handle:** NA


- [x] **Add tests and docs**: NA


- [x] **Lint and test**: make format, make lint and make test we run
successfully

---------

Co-authored-by: Arthur Cheng <arthur.cheng@oracle.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-10-31 02:35:25 +00:00
Erick Friis
128b07208e
community: release 0.3.4 (#27769) 2024-10-30 17:48:03 -07:00
Bagatur
6691202998
anthropic[patch]: allow multiple sys not at start (#27725) 2024-10-30 23:56:47 +00:00
Erick Friis
1ed3cd252e
langchain: release 0.3.6 (#27768) 2024-10-30 23:50:42 +00:00
Sergey Ryabov
8180637345
community[patch]: Fix Playwright Tools bug with Pydantic schemas (#27050)
- Add tests for Playwright tools schema serialization
- Introduce base empty args Input class for BaseBrowserTool

Test Plan: `poetry run pytest
tests/unit_tests/tools/playwright/test_all.py`

Fixes #26758

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
2024-10-30 23:45:36 +00:00
Bagatur
92024d0d7d
infra: turn off release attestations (#27765) 2024-10-30 15:22:31 -07:00
Bagatur
deb4320d29
core[patch]: Release 0.3.14 (#27764) 2024-10-30 21:47:33 +00:00
Bagatur
5d337326b0
core[patch]: make get_all_basemodel_annotations public (#27761) 2024-10-30 14:43:29 -07:00
Bagatur
94ea950c6c
core[patch]: support bedrock converse -> openai tool (#27754) 2024-10-30 12:20:39 -07:00
Lorenzo
3dfdb3e6fb
community: prevent gitlab commit on main branch for Gitlab tool (#27750)
### About

- **Description:** In the Gitlab utilities used for the Gitlab tool
there is no check to prevent pushing to the main branch, as this is
already done for Github (for example here:
5a2cfb49e0/libs/community/langchain_community/utilities/github.py (L587)).
This PR add this check as already done for Github.
- **Issue:** None
- **Dependencies:** None
2024-10-30 18:50:13 +00:00
Sam Julien
0a472e2a2d
community: Add Writer integration (#27646)
**Description:** Add support for Writer chat models   
**Issue:** N/A
**Dependencies:** Add `writer-sdk` to optional dependencies.
**Twitter handle:** Please tag `@samjulien` and `@Get_Writer`

**Tests and docs**
- [x] Unit test
- [x] Example notebook in `docs/docs/integrations` directory.

**Lint and test**
- [x] Run `make format` 
- [x] Run `make lint`
- [x] Run `make test`

---------

Co-authored-by: Johannes <tolstoy.work@gmail.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-10-30 18:06:05 +00:00
ccurme
595dc592c9
docs: run how-to guides in CI (#27615)
Add how-to guides to [Run notebooks
job](https://github.com/langchain-ai/langchain/actions/workflows/run_notebooks.yml)
and fix existing notebooks.

- As with tutorials, cassettes must be updated when HTTP calls in guides
change (by running existing
[script](https://github.com/langchain-ai/langchain/blob/master/docs/scripts/update_cassettes.sh)).
- Cassettes now total ~62mb over 474 files.
- `docs/scripts/prepare_notebooks_for_ci.py` lists a number of notebooks
that do not run (e.g., due to requiring additional infra, slowness,
requiring `input()`, etc.).
2024-10-30 12:35:38 -04:00
ccurme
88bfd60b03
infra: specify python max version of 3.12 for some integration packages (#27740) 2024-10-30 12:24:48 -04:00
fayvor
3b956b3a97
community: Update Replicate LLM and fix tests (#27655)
**Description:** 
- Fix bug in Replicate LLM class, where it was looking for parameter
names in a place where they no longer exist in pydantic 2, resulting in
the "Field required" validation error described in the issue.
- Fix Replicate LLM integration tests to:
  - Use active models on Replicate.
- Use the correct model parameter `max_new_tokens` as shown in the
[Replicate
docs](https://replicate.com/docs/guides/language-models/how-to-use#minimum-and-maximum-new-tokens).
  - Use callbacks instead of deprecated callback_manager.

**Issue:** #26937 

**Dependencies:** n/a

**Twitter handle:** n/a

---------

Signed-off-by: Fayvor Love <fayvor@gmail.com>
Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-10-30 16:07:08 +00:00
Yuki Watanabe
e593e017d2
Update compatibility table for ChatDatabricks (#27676)
`ChatDatabricks` added support for structured output and JSON mode in
the last release. This PR updates the feature table accordingly.

Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
2024-10-30 11:56:55 -04:00
ccurme
bd5ea18a6c
groq[patch]: update standard tests (#27744)
- Add xfail on integration test (fails [> 50% of the
time](https://github.com/langchain-ai/langchain/actions/workflows/scheduled_test.yml));
- Remove xfail on passing unit test.
2024-10-30 15:50:51 +00:00
hmn falahi
98bb3a02bd
docs: Add OpenAIAssistantV2Runnable docstrings (#27402)
- **Description:** add/improve docstrings of OpenAIAssistantV2Runnable
- **Issue:** the issue #21983

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-10-30 15:35:51 +00:00
Luiz F. G. dos Santos
7a29ca6200
community: add new parameters to pass to OpenAIAssistantV2Runnable (#27372)
Thank you for contributing to LangChain!
 
**Description:** Added the model parameters to be passed in the OpenAI
Assistant. Enabled it at the `OpenAIAssistantV2Runnable` class.
 **Issue:** NA
  **Dependencies:** None
  **Twitter handle:** luizf0992
2024-10-30 10:51:03 -04:00
Ankur Singh
0b97135da1
fix the grammar and markdown component (#27657)
## Before

![Screenshot from 2024-10-26
08-47-29](https://github.com/user-attachments/assets/d8ccead1-3ba3-4f67-a29f-ef8b352341cf)

## After


![image](https://github.com/user-attachments/assets/78f36d54-b2d7-4164-b334-8ac41000711e)

## Typo
`(either in PR summary of in a linked issue)` => `either in PR summary
or in a linked issue`

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-10-30 14:47:26 +00:00
Abdesselam Benameur
8fb6708ac4
Fix typo (missing letter) in elasticsearch_retriever.ipynb (#27639)
Fixed a small typo (added a missing "t" in ElasticsearchRetriever docs
page)


https://python.langchain.com/docs/integrations/retrievers/elasticsearch_retriever/#:~:text=It%20is%20possible%20to%20cusomize%20the%20function%20tha%20maps%20an%20Elasticsearch%20result%20(hit)%20to%20a%20LangChain%20document.
2024-10-30 14:38:39 +00:00
随风枫叶
18cfb4c067
community: Add token_usage and model_name metadata to ChatZhipuAI stream() and astream() response (#27677)
Thank you for contributing to LangChain!


- **Description:** Add token_usage and model_name metadata to
ChatZhipuAI stream() and astream() response
- **Issue:** None
- **Dependencies:** None
- **Twitter handle:** None


- [ ] **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: jianfehuang <jianfehuang@tencent.com>
2024-10-30 10:34:33 -04:00
Martin Gullbrandson
8a5807a6b4
docs: Update Milvus documentation to correctly show how to filter in similarity_search (#27723)
### Description/Issue:

I had problems filtering when setting up a local Milvus db and noticed
that the `filter` option in the `similarity_search` and
`similarity_search_with_score` appeared to do nothing. Instead, the
`expr` option should be used.

The `expr` option is correctly used in the retriever example further
down in the documentation.

The `expr` option seems to be correctly passed on, for example
[here](447c0dd2f0/libs/community/langchain_community/vectorstores/milvus.py (L701))

### Solution:

Update the documentation for the functions mentioned to show intended
behavior.

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-10-30 14:15:11 +00:00
tkubo-heroz
028e0253d8
community: Added anthropic.claude-3-5-sonnet-20241022-v2:0 cost detials (#27728)
Added anthropic.claude-3-5-sonnet-20241022-v2:0 cost detials
2024-10-30 14:01:01 +00:00
Changyong Um
dc171221b3
community[patch]: Fix vLLM integration to apply lora_request (#27731)
**Description:**
- Add the `lora_request` parameter to the VLLM class to support LoRA
model configurations. This enhancement allows users to specify LoRA
requests directly when using VLLM, enabling more flexible and efficient
model customization.

**Issue:**
- No existing issue for `lora_adapter` in VLLM. This PR addresses the
need for configuring LoRA requests within the VLLM framework.
- Reference : [Using LoRA Adapters in
vLLM](https://docs.vllm.ai/en/stable/models/lora.html#using-lora-adapters)


**Example Code :**
Before this change, the `lora_request` parameter was not applied
correctly:

```python
ADAPTER_PATH = "/path/of/lora_adapter"

llm = VLLM(model="Bllossom/llama-3.2-Korean-Bllossom-3B",
           max_new_tokens=512,
           top_k=2,
           top_p=0.90,
           temperature=0.1,
           vllm_kwargs={
               "gpu_memory_utilization":0.5, 
               "enable_lora":True, 
               "max_model_len":1024,
           }
)

print(llm.invoke(
    ["...prompt_content..."], 
    lora_request=LoRARequest("lora_adapter", 1, ADAPTER_PATH)
    ))
```
**Before Change Output:**
```bash
response was not applied lora_request
```
So, I attempted to apply the lora_adapter to
langchain_community.llms.vllm.VLLM.

**current output:**
```bash
response applied lora_request
```

**Dependencies:**
- None

**Lint and test:**
- All tests and lint checks have passed.

---------

Co-authored-by: Um Changyong <changyong.um@sfa.co.kr>
2024-10-30 13:59:34 +00:00
Nawaz Haider
9d2f6701e1
DOCS: Fixed import of langchain instead of langchain_nvidia_ai_endpoints for ChatNVIDIA (#27734)
* **PR title**: "docs: Replaced langchain import with
langchain-nvidia-ai-endpoints in NVIDIA Endpoints Tab"

* **PR message**:
+ **Description:** Replaced the import of `langchain` with
`langchain-nvidia-ai-endpoints` in the NVIDIA Endpoints Tab to resolve
an error caused by the documentation attempting to import the generic
`langchain` module despite the targeted import.
	+ **Issue:** 
+ **Dependencies:** No additional dependencies introduced; simply
updated the existing import to a more specific module.
	+ **Twitter handle:** https://x.com/nawaz0x1

* **Add tests and docs**:
+ **Applicability:** Not applicable in this case, as the change is a fix
to an existing integration rather than the addition of a new one.
+ **Rationale:** No new functionality or integrations are introduced,
only a corrective import change.

* **Lint and test**:
	+ **Status:** Completed
	+ **Outcome:** 
		- `make format`: **Passed**
		- `make lint`: **Passed**
		- `make test`: **Passed**


![image](https://github.com/user-attachments/assets/fbc1b597-5083-4461-875a-d32ab8ed933c)
2024-10-30 13:57:37 +00:00
Qier LU
8d8e38b090
community[pathch]: Add missing custom content_key handling in Redis vector store (#27736)
This fix an error caused by missing custom content_key handling in Redis
vector store in function similarity_search_with_score.
2024-10-30 13:57:20 +00:00
William FH
5a2cfb49e0
Support message trimming on single messages (#27729)
Permit trimming message lists of length 1
2024-10-30 04:27:52 +00:00
Bagatur
5111063af2
langchain[patch]: Release 0.3.5 (#27727) 2024-10-29 17:06:23 -07:00
Bagatur
8f4423e042
text-splitters[patch]: Release 0.3.1 (#27726) 2024-10-30 00:04:48 +00:00
Prithvi Kannan
0433b114bb
docs: Add databricks-langchain package consolidation notice (#27703)
Thank you for contributing to LangChain!

Add notice of upcoming package consolidation of `langchain-databricks`
into `databricks-langchain`.

<img width="1047" alt="image"
src="https://github.com/user-attachments/assets/18eaa394-4e82-444b-85d5-7812be322674">


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.

Signed-off-by: Prithvi Kannan <prithvi.kannan@databricks.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-10-29 22:00:27 +00:00
Zapiron
447c0dd2f0
docs: Fixed Grammar & Improve reading (#27672)
Updated the documentation to fix some grammar errors

    - **Description:** Some language errors exist in the documentation
    - **Issue:** the issue # Changed the structure of some sentences
2024-10-29 20:19:00 +00:00
Soham Das
913ff1b152
docs: fix typo in query analysis documentation (#27721)
**PR Title**: `docs: fix typo in query analysis documentation`

**Description**: This PR corrects a typo on line 68 in the query
analysis documentation, changing **"pharsings"** to **"phrasings"** for
clarity and accuracy. Only one instance of the typo was fixed in the
last merge, and this PR fixes the second instance.

**Issue**: N/A

**Dependencies**: None

**Additional Notes**: No functional changes were made; this is a
documentation fix only.
2024-10-29 16:15:37 -04:00
Erick Friis
8396ca2990
docs: redis in api docs (#27722) 2024-10-29 20:13:53 +00:00
Mateusz Szewczyk
0606aabfa3
docs: Added WatsonxRerank documentation (#27424)
Thank you for contributing to LangChain!

Changes:
- docs: Added `WatsonxRerank` documentation 
- docs Updated `WatsonxEmbeddings` with docs template
- docs: Updated `ChatWatsonx` with docs template
- docs: Updated `WatsonxLLM` with docs template
- docs: Added `ChatWatsonx` to list with Chat models providers. Added
[test_chat_models_standard](https://github.com/langchain-ai/langchain-ibm/blob/main/libs/ibm/tests/integration_tests/test_chat_models_standard.py)
to `langchain_ibm` tests suite.
- docs: Added `IBM` to list with Embedding models providers. Added
[test_embeddings_standard](https://github.com/langchain-ai/langchain-ibm/blob/main/libs/ibm/tests/integration_tests/test_embeddings_standard.py)
to `langchain_ibm` tests suite.
- docs: Updated `langcahin_ibm` recommended versions compatible with
`LangChain v0.3`

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-10-29 16:57:47 +00:00
Zapiron
9ccd4a6ffb
DOC: Tutorial Section Updates (#27675)
Edited various notebooks in the tutorial section to fix:
* Grammatical Errors
* Improve Readability by changing the sentence structure or reducing
repeated words which bears the same meaning
* Edited a code block to follow the PEP 8 Standard
* Added more information in some sentences to make the concept more
clear and reduce ambiguity

---------

Co-authored-by: Eugene Yurtsev <eugene@langchain.dev>
2024-10-29 14:51:34 +00:00
Harsimran-19
c1d8c33df6
core: JsonOutputParser UTF characters bug (#27306)
**Description:**
This PR fixes an issue where non-ASCII characters in Pydantic field
descriptions were being escaped to their Unicode representations when
using `JsonOutputParser`. The change allows non-ASCII characters to be
preserved in the output, which is especially important for multilingual
support and when working with non-English languages.

**Issue:** Fixes #27256

**Example Code:**
```python
from pydantic import BaseModel, Field
from langchain_core.output_parsers import JsonOutputParser

class Article(BaseModel):
    title: str = Field(description="科学文章的标题")

output_data_structure = Article
parser = JsonOutputParser(pydantic_object=output_data_structure)
print(parser.get_format_instructions())
```
**Previous Output**:
```... "title": {"description": "\\u79d1\\u5b66\\u6587\\u7ae0\\u7684\\u6807\\u9898", "title": "Title", "type": "string"}} ...```

**Current Output**:
```... "title": {"description": "科学文章的标题", "title": "Title", "type":
"string"}} ...```

**Changes made**:
- Modified `json.dumps()` call in
`langchain_core/output_parsers/json.py` to use `ensure_ascii=False`
- Added a unit test to verify Unicode handling

Co-authored-by: Harsimran-19 <harsimran1869@gmail.com>
2024-10-29 14:48:53 +00:00
Andrew Effendi
49517cc1e7
partners/huggingface[patch]: fix HuggingFacePipeline model_id parameter (#27514)
**Description:** Fixes issue with model parameter not getting
initialized correctly when passing transformers pipeline
**Issue:** https://github.com/langchain-ai/langchain/issues/25915
2024-10-29 14:34:46 +00:00
Jeong-Minju
0a465b8032
docs: Fix typo in _action_agent docs section (#27698)
PR Title: docs: Fix typo in _action_agent function docs section

Description: In line 1185, _action_agent function's docs, changing
**".agent"** to **"self.agent"**.

Issue: N/A

Dependencies: None

---------

Co-authored-by: Eugene Yurtsev <eugene@langchain.dev>
2024-10-29 14:16:42 +00:00
Soham Das
c3021e9322
docs: fix typo in query analysis documentation (#27697)
**PR Title**: `docs: fix typo in query analysis documentation`

**Description**: This PR corrects a typo on line 68 in the query
analysis documentation, changing **"pharsings"** to **"phrasings"** for
clarity and accuracy.

**Issue**: N/A

**Dependencies**: None

**Additional Notes**: No functional changes were made; this is a
documentation fix only.
2024-10-29 14:07:22 +00:00
Neil Vachharajani
eec35672a4
core[patch]: Improve type checking for the tool decorator (#27460)
**Description:**

When annotating a function with the @tool decorator, the symbol should
have type BaseTool. The previous type annotations did not convey that to
type checkers. This patch creates 4 overloads for the tool function for
the 4 different use cases.

1. @tool decorator with no arguments
2. @tool decorator with only keyword arguments
3. @tool decorator with a name argument (and possibly keyword arguments)
4. Invoking tool as function with a name and runnable positional
arguments

The main function is updated to match the overloads. The changes are
100% backwards compatible (all existing calls should continue to work,
just with better type annotations).

**Twitter handle:** @nvachhar

---------

Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
2024-10-29 13:59:56 +00:00
Erick Friis
94e5765416
docs: packages in homepage (#27693) 2024-10-28 20:44:30 +00:00
Erick Friis
583808a7b8
partners/huggingface: release 0.1.1 (#27691) 2024-10-28 13:39:38 -07:00
Erick Friis
6d524e9566
partners/box: release 0.2.2 (#27690) 2024-10-28 12:54:20 -07:00
yahya-mouman
6803cb4f34
openai[patch]: add check for none values when summing token usage (#27585)
**Description:** Fixes None addition issues when an empty value is
passed on

If no one reviews your PR within a few days, please @-mention one of
baskaryan, efriis, eyurtsev, ccurme, vbarda, hwchase17.
2024-10-28 12:49:43 -07:00
Bagatur
ede953d617
openai[patch]: fix schema formatting util (#27685) 2024-10-28 15:46:47 +00:00
Baptiste Pasquier
440c162b8b
community: Fix closed session in Infinity (#26933)
**Description:** 

The `aiohttp.ClientSession` is closed at the end of the with statement,
which causes an error during a second call.

The implemented fix is to define the session directly within the with
block, exactly like in the textembed code:


c6350d636e/libs/community/langchain_community/embeddings/textembed.py (L335-L346)
 
**Issue:** Fix #26932

Co-authored-by: ccurme <chester.curme@gmail.com>
2024-10-27 11:37:21 -04:00