Commit Graph

9027 Commits (d7e12750df1b696793097ca049dccbebf1fc3f3c)
 

Author SHA1 Message Date
Eugene Yurtsev a2cc9b55ba
core[patch]: Remove autoupgrade to addable dict in Runnable/RunnableLambda/RunnablePassthrough transform (#20677)
Causes an issue for this code

```python
from langchain.chat_models.openai import ChatOpenAI
from langchain.output_parsers.openai_tools import JsonOutputToolsParser
from langchain.schema import SystemMessage

prompt = SystemMessage(content="You are a nice assistant.") + "{question}"

llm = ChatOpenAI(
    model_kwargs={
        "tools": [
            {
                "type": "function",
                "function": {
                    "name": "web_search",
                    "description": "Searches the web for the answer to the question.",
                    "parameters": {
                        "type": "object",
                        "properties": {
                            "query": {
                                "type": "string",
                                "description": "The question to search for.",
                            },
                        },
                    },
                },
            }
        ],
    },
    streaming=True,
)

parser = JsonOutputToolsParser(first_tool_only=True)

llm_chain = prompt | llm | parser | (lambda x: x)


for chunk in llm_chain.stream({"question": "tell me more about turtles"}):
    print(chunk)

# message = llm_chain.invoke({"question": "tell me more about turtles"})

# print(message)
```

Instead by definition, we'll assume that RunnableLambdas consume the
entire stream and that if the stream isn't addable then it's the last
message of the stream that's in the usable format.

---

If users want to use addable dicts, they can wrap the dict in an
AddableDict class.

---

Likely, need to follow up with the same change for other places in the
code that do the upgrade
2 months ago
Oleksandr Yaremchuk 9428923bab
experimental[minor]: upgrade the prompt injection model (#20783)
- **Description:** In January, Laiyer.ai became part of ProtectAI, which
means the model became owned by ProtectAI. In addition to that,
yesterday, we released a new version of the model addressing issues the
Langchain's community and others mentioned to us about false-positives.
The new model has a better accuracy compared to the previous version,
and we thought the Langchain community would benefit from using the
[latest version of the
model](https://huggingface.co/protectai/deberta-v3-base-prompt-injection-v2).
- **Issue:** N/A
- **Dependencies:** N/A
- **Twitter handle:** @alex_yaremchuk
2 months ago
Eugene Yurtsev 645b1e142e
core[minor],langchain[patch],community[patch]: Move InMemory and File implementations of Chat History to core (#20752)
This PR moves the implementations for chat history to core. So it's
easier to determine which dependencies need to be broken / add
deprecation warnings
2 months ago
ccurme 7a922f3e48
core, openai: support custom token encoders (#20762) 2 months ago
Chen94yue b481b73805
Update custom_retriever.ipynb (#20776)
Fixed an error in the sample code to ensure that the code can run
directly.

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, hwchase17.
2 months ago
Bagatur ed980601e1
docs: update examples in api ref (#20768) 2 months ago
Bagatur be51cd3bc9
docs: fix api ref link autogeneration (#20766) 2 months ago
monke111 c807f0a6dd
Update google_drive.ipynb (#20731)
langchain_community.document_loaders depricated 
new langchain_google_community

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, hwchase17.
2 months ago
Katarina Supe dc61e23886
docs: update Memgraph docs (#20736)
- **Description:** Memgraph Platform is being run differently now so I
updated this (I am DX engineer from Memgraph).
2 months ago
Tabish Mir 6a0d44d632
docs: Fix link for `partition_pdf` in Semi_Structured_RAG.ipynb cookbook (#20763)
docs: Fix link for `partition_pdf` in Semi_Structured_RAG.ipynb cookbook

- **Description:** Fix incorrect link to unstructured-io `partition_pdf`
section
2 months ago
Bagatur fa4d6f9f8b
docs: install partner pkgs vercel (#20761) 2 months ago
Christophe Bornet 0ae5027d98
community[patch]: Remove usage of deprecated StoredBlobHistory in CassandraChatMessageHistory (#20666) 2 months ago
Bagatur eb18f4e155
infra: rm sep repo partner dirs (#20756)
so you can `poetry run pip install -e libs/partners/*/` to your hearts
content
2 months ago
Bagatur 2a11a30572
docs: automatically add api ref links (#20755)
![Screenshot 2024-04-22 at 1 51 13
PM](https://github.com/langchain-ai/langchain/assets/22008038/b8b09fec-3800-4b97-bd26-5571b8308f4a)
2 months ago
Eugene Yurtsev 936c6cc74a
langchain[patch]: Add missing deprecation for openai adapters (#20668)
Add missing deprecation for openai adapters
2 months ago
Eugene Yurtsev 38adbfdf34
community[patch],core[minor]: Move BaseToolKit to core.tools (#20669) 2 months ago
Mark Needham ce23f8293a
Community patch clickhouse make it possible to not specify index (#20460)
Vector indexes in ClickHouse are experimental at the moment and can
sometimes break/change behaviour. So this PR makes it possible to say
that you don't want to specify an index type.

Any queries against the embedding column will be brute force/linear
scan, but that gives reasonable performance for small-medium dataset
sizes.

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2 months ago
ccurme c010ec8b71
patch: deprecate (a)get_relevant_documents (#20477)
- `.get_relevant_documents(query)` -> `.invoke(query)`
- `.get_relevant_documents(query=query)` -> `.invoke(query)`
- `.get_relevant_documents(query, callbacks=callbacks)` ->
`.invoke(query, config={"callbacks": callbacks})`
- `.get_relevant_documents(query, **kwargs)` -> `.invoke(query,
**kwargs)`

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2 months ago
A Noor 939d113d10
docs: Fixed grammar mistake (#20697)
Description: Changed "You are" to "You are a". Grammar issue.
Dependencies: None

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2 months ago
Matheus Henrique Raymundo bb69819267
community: Fix the stop sequence key name for Mistral in Bedrock (#20709)
Fixing the wrong stop sequence key name that causes an error on AWS
Bedrock.
You can check the MistralAI bedrock parameters
[here](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-mistral.html)
This change fixes this
[issue](https://github.com/langchain-ai/langchain/issues/20095)
2 months ago
Bagatur 1c7b3c75a7
community[patch], experimental[patch]: support tool-calling sql and p… (#20639)
d agents
2 months ago
Bagatur d0cee65cdc
langchain[patch]: langchain-pinecone self query support (#20702) 2 months ago
Leonid Kuligin 5ae738c4fe
docs: on google-genai vs google-vertexai (#20713)
Thank you for contributing to LangChain!

- [ ] **PR title**: "docs: added a description of differences
langchain_google_genai vs langchain_google_vertexai"


- [ ]
- **Description:** added a description of differences
langchain_google_genai vs langchain_google_vertexai
2 months ago
shumway743 cb6e5e56c2
community[minor]: add graph store implementation for apache age (#20582)
**Description:** implemented GraphStore class for Apache Age graph db

**Dependencies:** depends on psycopg2

Unit and integration tests included. Formatting and linting have been
run.

---------

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
2 months ago
Christophe Bornet c909ae0152
community[minor]: Add async methods to CassandraVectorStore (#20602)
Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
2 months ago
Leonid Ganeline 06d18c106d
langchain[patch]: `example_selector` import fix (#20676)
Cleaned up updated imports
2 months ago
Leonid Ganeline d6470aab60
langchain: `dosctore` import fix (#20678)
Cleaned up imports
2 months ago
Leonid Ganeline 3a750e130c
templates: `utilities` import fix (#20679)
Updated imports from `from langchain.utilities` to `from
langchain_community.utilities`
2 months ago
Dmitry Tyumentsev f111efeb6e
community[patch]: YandexGPT API add ability to disable request logging (#20670)
Closes (#20622)

Added the ability to [disable logging of requests to
YandexGPT](https://yandex.cloud/en/docs/foundation-models/operations/yandexgpt/disable-logging).
2 months ago
Erick Friis e5f5d9ff56
docs: aws listing (#20674) 2 months ago
Mateusz Szewczyk 75ffe51bbe
ibm: Add support for Embedding Models (#20647)
---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2 months ago
Erick Friis 73809817ff
community: release 0.0.34 (#20672) 2 months ago
Tomaz Bratanic e4b38e2822
Update neo4j cypher templates to the function callback (#20515)
Update Neo4j Cypher templates to use function callback to pass context
instead of passing it in user prompt.

Co-authored-by: Erick Friis <erick@langchain.dev>
2 months ago
Tomaz Bratanic 3d9b26fc28
Update neo4j vector documentation (#20455)
Co-authored-by: Chester Curme <chester.curme@gmail.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2 months ago
Tomaz Bratanic 8c08cf4619
community: Add support for relationship indexes in neo4j vector (#20657)
Neo4j has added relationship vector indexes.
We can't populate them, but we can use existing indexes for retrieval
2 months ago
Erick Friis 940242c1ec
core: release 0.1.45 (#20664) 2 months ago
Saurabh Chalke 3dd6266bcc
docs: Remove Duplicate --quiet Flag in Installation Command in LangSmith Docs (#20121)
**Description:** This pull request removes a duplicated `--quiet` flag
in the pip install command found in the LangSmith Walkthrough section of
the documentation.

**Issue:** N/A

**Dependencies:** None
2 months ago
Aditya 6a97448928
Updated Tutorials for Vertex Vector Search (#20376)
Thank you for contributing to LangChain!

- [ ] **PR title**: "package: docs"


- [ ] **PR message**: 
    - **Description:** Updated Tutorials for Vertex Vector Search
    - **Issue:** NA
    - **Dependencies:** NA
- **Twitter handle:** if your PR gets announced, and you'd like a
mention, we'll gladly shout you out!

@lkuligin for review

---------

Co-authored-by: adityarane@google.com <adityarane@google.com>
Co-authored-by: Leonid Kuligin <lkuligin@yandex.ru>
Co-authored-by: Chester Curme <chester.curme@gmail.com>
2 months ago
Boris Djurdjevic c5aab9afe3
docs: Fix minor typo in data_connection/document_loaders/custom (#20648)
**Description:**
Minor documentation typo fix in
`data_connection/document_loaders/custom`: `thta's` -> `that's`
2 months ago
Souls-R 36084e7500
docs: fix variable name typo in example code (#20658)
This pull request corrects a mistake in the variable name within the
example code. The variable doc_schema has been changed to dog_schema to
fix the error.
2 months ago
Leonid Ganeline beebd73f95
docs: `integrations/retrievers` cleanup (#20357)
Fixed format inconsistencies; added descriptions, links.
2 months ago
Leonid Ganeline 0b99e9201d
docs: providers `alibaba` update (#20560)
Added missed integrations to the Alibaba Cloud provider page
2 months ago
Leonid Ganeline 27a4682415
docs: imports update (#20625)
Updated imports in docs

Co-authored-by: Erick Friis <erick@langchain.dev>
2 months ago
Ethan Yang 53ae77b13e
docs: Update openvino example documents links (#20638) 2 months ago
Sivaudha baedc3ec0a
langchain[minor]: Databricks vector search self query integration (#20627)
- Enable self querying feature for databricks vector search

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2 months ago
ccurme 6d530481c1
openai: fix allowed block types (#20636) 2 months ago
Erick Friis 764871f97d
infra: add test-doc-imports to ci failure (#20637) 2 months ago
Erick Friis 5c216ad08f
upstage[patch]: un-xfail tool calling test, release 0.1.0 (#20635) 2 months ago
Nuno Campos 48307e46a3
core[patch]: Fix runnable map ser/de (#20631) 2 months ago
Charlie Holtz 1cbab0ebda
community: update Replicate to work with official models (#20633)
Description: you don't need to pass a version for Replicate official
models. That was broken on LangChain until now!

You can now run: 

```
llm = Replicate(
    model="meta/meta-llama-3-8b-instruct",
    model_kwargs={"temperature": 0.75, "max_length": 500, "top_p": 1},
)
prompt = """
User: Answer the following yes/no question by reasoning step by step. Can a dog drive a car?
Assistant:
"""
llm(prompt)
```

I've updated the replicate.ipynb to reflect that.

twitter: @charliebholtz

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2 months ago