Commit Graph

11975 Commits

Author SHA1 Message Date
Eugene Yurtsev
84527fc502 another lint 2024-11-22 16:53:01 -05:00
Eugene Yurtsev
464cd320cb lint 2024-11-22 16:50:45 -05:00
Eugene Yurtsev
8dd8b41b6c qx 2024-11-22 16:48:07 -05:00
Eugene Yurtsev
caaa03c0a6 qxqx 2024-11-22 16:45:25 -05:00
Eugene Yurtsev
906a0b2972 x 2024-11-22 16:45:02 -05:00
Eugene Yurtsev
8511241b87 x 2024-11-22 16:37:06 -05:00
Eugene Yurtsev
fd7860e508 x 2024-11-22 16:35:04 -05:00
Eugene Yurtsev
33b3e22083 x 2024-11-22 16:30:34 -05:00
Eugene Yurtsev
c0c6d61fa5 x 2024-11-22 16:25:22 -05:00
Eugene Yurtsev
7ea38acf2d x 2024-11-22 16:24:12 -05:00
Eugene Yurtsev
557f85d7fd x 2024-11-22 16:21:07 -05:00
Eugene Yurtsev
6119424343 x 2024-11-22 16:19:25 -05:00
Eugene Yurtsev
34fcd93b33 qx 2024-11-22 15:44:05 -05:00
ccurme
697dda5052
core[patch]: release 0.3.20 (#28293) 2024-11-22 14:04:29 -05:00
ccurme
a433039a56
core[patch]: support final AIMessage responses in tool_example_to_messages (#28267)
We have a test
[test_structured_few_shot_examples](ad4333ca03/libs/standard-tests/langchain_tests/integration_tests/chat_models.py (L546))
in standard integration tests that implements a version of tool-calling
few shot examples that works with ~all tested providers. The formulation
supported by ~all providers is: `human message, tool call, tool message,
AI reponse`.

Here we update
`langchain_core.utils.function_calling.tool_example_to_messages` to
support this formulation.

The `tool_example_to_messages` util is undocumented outside of our API
reference. IMO, if we are testing that this function works across all
providers, it can be helpful to feature it in our guides. The structured
few-shot examples we document at the moment require users to implement
this function and can be simplified.
2024-11-22 15:38:49 +00:00
Manuel
a5fcbe69eb
docs: correct HuggingFaceEmbeddings documentation model param (#28269)
- **Description:** Corrected the parameter name in the
HuggingFaceEmbeddings documentation under integrations/text_embedding/
from model to model_name to align with the actual code usage in the
langchain_huggingface package.
- **Issue:** Fixes #28231
- **Dependencies:** None
2024-11-22 09:59:33 -05:00
Erick Friis
65deeddd5d
docs: poetry publish 3 (#28280) 2024-11-22 05:14:28 +00:00
Erick Friis
29f8a79ebe
groq,openai,mistralai: fix unit tests (#28279) 2024-11-22 04:54:01 +00:00
Erick Friis
9a717c9b32
docs: poetry publish 2 (#28277)
- **docs: poetry publish**
- **x**
- **x**
- **x**
- **x**
- **x**
- **x**
- **x**
- **x**
- **x**
2024-11-21 20:49:38 -08:00
Erick Friis
4ccb3e64c7
cli: release 0.0.33 (#28278) 2024-11-21 20:13:37 -08:00
Prithvi Kannan
2917f8573f
docs: Update langchain docs to new Databricks package (#28274)
Thank you for contributing to LangChain!

Ctrl+F to find instances of `langchain-databricks` and replace with
`databricks-langchain`.

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>
2024-11-21 20:03:28 -08:00
Erick Friis
49254cde70
docs: poetry publish (#28275) 2024-11-22 03:10:03 +00:00
Erick Friis
f173b72e35
api-docs: add standard tests package to build 2 (#28273) 2024-11-21 15:40:48 -08:00
Erick Friis
45402d1a20
api-docs: add standard tests package to build (#28272) 2024-11-21 15:35:47 -08:00
Erick Friis
b3ee1f8713
core: add space at end of error message link (#28270) 2024-11-21 22:19:59 +00:00
Erick Friis
5bc2df3060
standard-tests: troubleshooting docstrings (#28268) 2024-11-21 22:05:31 +00:00
Erick Friis
ad4333ca03
infra: disable vertex api build (#28266) 2024-11-21 10:37:17 -08:00
Erick Friis
69a706adff
infra: fix api docs build (#28264) 2024-11-21 10:25:52 -08:00
ccurme
56499cf58b
openai[patch]: unskip test and relax tolerance in embeddings comparison (#28262)
From what I can tell response using SDK is not deterministic:
```python
import numpy as np
import openai

documents = ["disallowed special token '<|endoftext|>'"]
model = "text-embedding-ada-002"

direct_output_1 = (
    openai.OpenAI()
    .embeddings.create(input=documents, model=model)
    .data[0]
    .embedding
)

for i in range(10):
    direct_output_2 = (
        openai.OpenAI()
        .embeddings.create(input=documents, model=model)
        .data[0]
        .embedding
    )
    print(f"{i}: {np.isclose(direct_output_1, direct_output_2).all()}")
```
```
0: True
1: True
2: True
3: True
4: False
5: True
6: True
7: True
8: True
9: True
```

See related discussion here:
https://community.openai.com/t/can-text-embedding-ada-002-be-made-deterministic/318054

Found the same result using `"text-embedding-3-small"`.
2024-11-21 10:23:10 -08:00
Priyanshi Garg
f5f53d1101
community: fix compatibility issue in kinetica chat model integration for Pydantic 2 (#28252)
Fixed a compatibility issue in the `load_messages_from_context()`
function for the Kinetica chat model integration. The issue was caused
by stricter validation introduced in Pydantic 2.
2024-11-21 09:33:00 -05:00
Erick Friis
96c67230aa
docs: standard test version badge (#28247) 2024-11-21 04:00:04 +00:00
Erick Friis
d1108607f4
multiple: push deprecation removals to 1.0 (#28236) 2024-11-20 19:56:29 -08:00
Erick Friis
4f76246cf2
standard-tests: release 0.3.4 (#28245) 2024-11-20 19:35:58 -08:00
Erick Friis
4bdf1d7d1a
standard-tests: fix decorator init test (#28246) 2024-11-21 03:35:43 +00:00
Erick Friis
60e572f591
standard-tests: tool tests (#28244) 2024-11-20 19:26:16 -08:00
Erick Friis
35e6052df5
infra: remove stale dockerfiles from repo (#28243)
deleting the following docker things from monorepo. they aren't
currently usable because of old dependencies, and I'd rather avoid
people using them / having to maintain them

- /docker
- this folder has a compose file that spins up postgres,pgvector
(separate from postgres and very stale version),mongo instance with
default user/password that we've gotten security pings about before. not
worth having
- also spins up a custom dockerfile with onttotext/graphdb - not even
sure what that is
- /libs/langchain/dockerfile + dev.dockerfile
  - super old poetry version, doesn't implement the right thing anymore
- .github/workflows/_release_docker.yml, langchain_release_docker.yml
  - not used anymore, not worth having an alternate release path
2024-11-21 00:05:01 +00:00
Erick Friis
161ab736ce
standard-tests: release 0.3.3 (#28242) 2024-11-20 23:47:02 +00:00
Erick Friis
8738973267
docs: vectorstore standard tests (#28241) 2024-11-20 23:38:08 +00:00
Eugene Yurtsev
2acc83f146
mistralai[patch]: 0.2.2 release (#28240)
mistralai 0.2.2 release
2024-11-20 22:18:15 +00:00
Eugene Yurtsev
1a66175e38
mistral[patch]: Propagate tool call id (#28238)
mistralai-large-2411 requires tool call id

Older models accept tool call id if its provided

mistral-large-2407 
mistral-large-2402
2024-11-20 17:02:30 -05:00
shroominic
dee72c46c1
community: Outlines integration (#27449)
In collaboration with @rlouf I build an
[outlines](https://dottxt-ai.github.io/outlines/latest/) integration for
langchain!

I think this is really useful for doing any type of structured output
locally.
[Dottxt](https://dottxt.co) spend alot of work optimising this process
at a lower level
([outlines-core](https://pypi.org/project/outlines-core/0.1.14/) written
in rust) so I think this is a better alternative over all current
approaches in langchain to do structured output.
It also implements the `.with_structured_output` method so it should be
a drop in replacement for a lot of applications.

The integration includes:
- **Outlines LLM class**
- **ChatOutlines class**
- **Tutorial Cookbooks**
- **Documentation Page**
- **Validation and error messages** 
- **Exposes Outlines Structured output features**
- **Support for multiple backends**
- **Integration and Unit Tests**

Dependencies: `outlines` + additional (depending on backend used)

I am not sure if the unit-tests comply with all requirements, if not I
suggest to just remove them since I don't see a useful way to do it
differently.

### Quick overview:

Chat Models:
<img width="698" alt="image"
src="https://github.com/user-attachments/assets/05a499b9-858c-4397-a9ff-165c2b3e7acc">

Structured Output:
<img width="955" alt="image"
src="https://github.com/user-attachments/assets/b9fcac11-d3e5-4698-b1ae-8c4cb3d54c45">

---------

Co-authored-by: Vadym Barda <vadym@langchain.dev>
2024-11-20 16:31:31 -05:00
Mikelarg
2901fa20cc
community: Add deprecation warning for GigaChat integration in langchain-community (#28022)
- **Description:** We have released the
[langchain-gigachat](https://github.com/ai-forever/langchain-gigachat?tab=readme-ov-file)
with new GigaChat integration that support's function/tool calling. This
PR deprecated legacy GigaChat class in community package.

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-11-20 21:03:47 +00:00
Renzo-vS
567dc1e422
community: fix duplicate content (#28003)
Thank you for reading my first PR!

**Description:**
Deduplicate content in AzureSearch vectorstore.
Currently, by default, the content of the retrieval is placed both in
metadata and page_content of a Document.
This PR removes the content from metadata, and leaves it in
page_content.

**Issue:**:
Previously, the content was popped from result before metadata was
populated.
In #25828 , the order was changed which leads to a response with
duplicated content.
This was not the intention of that PR and seems undesirable.

Looking forward to seeing my contribution in the next version!

Cheers, 
Renzo
2024-11-20 12:49:03 -08:00
Jorge Piedrahita Ortiz
abaea28417
community: SamabanovaCloud tool calling and Structured output (#27967)
**Description:** Add tool calling and structured output support for
SambaNovaCloud chat models, docs included

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-11-20 19:12:08 +00:00
ccurme
cb32bab69d
docs: update notebook env dependencies (#28221) 2024-11-20 14:10:42 -05:00
af su
7c7ee07d30
huggingface[fix]: HuggingFaceEndpointEmbeddings model parameter passing error when async embed (#27953)
This change refines the handling of _model_kwargs in POST requests.
Instead of nesting _model_kwargs as a dictionary under the parameters
key, it is now directly unpacked and merged into the request's JSON
payload. This ensures that the model parameters are passed correctly and
avoids unnecessary nesting.E. g.:

```python
import asyncio

from langchain_huggingface.embeddings import HuggingFaceEndpointEmbeddings

embedding_input = ["This input will get multiplied" * 10000]

embeddings = HuggingFaceEndpointEmbeddings(
    model="http://127.0.0.1:8081/embed",
    model_kwargs={"truncate": True},
)

# Truncated parameters in synchronized methods are handled correctly
embeddings.embed_documents(texts=embedding_input)
# The truncate parameter is not handled correctly in the asynchronous method,
# and 413 Request Entity Too Large is returned.
asyncio.run(embeddings.aembed_documents(texts=embedding_input))
```

Co-authored-by: af su <saf@zjuici.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-11-20 19:08:56 +00:00
Eric Pinzur
923ef85105
langchain_chroma: fixed integration tests (#27968)
Description:
* I'm planning to add `Document.id` support to the Chroma VectorStore,
but first I wanted to make sure all the integration tests were passing
first. They weren't. This PR fixes the broken tests.
* I found 2 issues:
* This change (from a year ago, exactly :) ) for supporting multi-modal
embeddings:
https://docs.trychroma.com/deployment/migration#migration-to-0.4.16---november-7,-2023
* This change https://github.com/langchain-ai/langchain/pull/27827 due
to an update in the chroma client.
  
Also ran `format` and `lint` on the changes.

Note: I am not a member of the Chroma team.
2024-11-20 11:05:02 -08:00
CLOVA Studio 개발
218b4e073e
community: fix some features on Naver ChatModel & embedding model (#28228)
# Description

- adding stopReason to response_metadata to call stream and astream
- excluding NCP_APIGW_API_KEY input required validation
- to remove warning Field "model_name" has conflict with protected
namespace "model_".

cc. @vbarda
2024-11-20 10:35:41 -08:00
Erick Friis
4da35623af
docs: formatting fix (#28235) 2024-11-20 18:08:47 +00:00
Erick Friis
43e24cd4a1
docs, standard-tests: property tags, support tool decorator (#28234) 2024-11-20 17:19:03 +00:00