Commit Graph

8281 Commits

Author SHA1 Message Date
Christophe Bornet
e54201f4dc langchain[patch]: Use async memory in Chain when needed (#19429) 2024-04-25 17:39:30 -07:00
Lance Martin
22b39ce924 docs: Remove non-rendering images & output spamming from doc ntbks (#19475)
Looking at tokens / page of our docs, we see a few outliers:
<img width="761" alt="image"
src="https://github.com/langchain-ai/langchain/assets/122662504/677aa2d6-0a29-45e4-882a-db2bbf46d02b">

It is due to non-rendering images in one case, and output spamming. 

Clean these, along with other cases of excessing output spamming in
docs.

All get sucked into chat-langchain for retrieval.
2024-04-25 17:39:30 -07:00
Erick Friis
75c179c5e6 mistralai[patch]: streaming tool calls (#19469) 2024-04-25 17:39:30 -07:00
aditya thomas
90125253a2 docs: adding voyageai to the list of partner packages (#19376)
**Description:** Adding VoyageAI to the list of partners
**Issue:** A standalone langchain-voyageai package has been added
**Dependencies:** None
2024-04-25 17:39:30 -07:00
Zeeland
9b2c1a919a docs: fix error bilibili url (#19375)
Thank you for contributing to LangChain!

bilibili-api-python use https://github.com/Nemo2011/bilibili-api repo.
Change to the correct address.

- [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, hwchase17.
2024-04-25 17:39:30 -07:00
aditya thomas
75ecf3d8e7 docs: update module imports for fireworks documentation (#19377)
**Description:** Update module imports for Fireworks documentation
**Issue:** Module imports not present or in incorrect location
**Dependencies:** None
2024-04-25 17:39:30 -07:00
aditya thomas
cf960bb505 docs: update import paths and move to lcel for llama.cpp examples (#19391)
**Description:** Update import paths and move to lcel for llama.cpp
examples
**Issue:** Update import paths to reflect package refactoring and move
chains to LCEL in examples
**Dependencies:** None

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2024-04-25 17:39:30 -07:00
fengjial
e5d3fecf3d community[patch]: fix bugs in baiduvectordb as vectorstore (#19380)
fix small bugs in vectorstore/baiduvectordb
2024-04-25 17:39:30 -07:00
Cailin Wang
1caced89db docs: Add partition parameter to DashVector (#19385)
**Description**: Add `partition` parameter to DashVector
dashvector.ipynb
**Related PR**: https://github.com/langchain-ai/langchain/pull/19023
**Twitter handle**: @CailinWang_

---------

Co-authored-by: root <root@Bluedot-AI>
2024-04-25 17:39:30 -07:00
aditya thomas
7750bf464d community[patch]: invoke callback prior to yielding token (openai) (#19389)
**Description:** Invoke callback prior to yielding token for BaseOpenAI
& OpenAIChat
**Issue:** [Callback for on_llm_new_token should be invoked before the
token is yielded by the model
#16913](https://github.com/langchain-ai/langchain/issues/16913)
**Dependencies:** None
2024-04-25 17:39:30 -07:00
aditya thomas
c1e531961a community[patch]: invoke callback prior to yielding token (fireworks) (#19388)
**Description:** Invoke callback prior to yielding token for Fireworks
**Issue:** [Callback for on_llm_new_token should be invoked before the
token is yielded by the model
#16913](https://github.com/langchain-ai/langchain/issues/16913)
**Dependencies:** None
2024-04-25 17:39:30 -07:00
aditya thomas
974728fe99 docs: moving FireworksEmbeddings documentation to docs folder (#19398)
**Description:** Moving FireworksEmbeddings documentation to the
location docs/integration/text_embedding/ from langchain_fireworks/docs/
**Issue:** FireworksEmbeddings documentation was not in the correct
location
**Dependencies:** None

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
2024-04-25 17:39:30 -07:00
Leonid Ganeline
c69b46512a infra: makefile api_docs_clean fix (#19405)
Fixed a Makefile command that cleans up the api_docs
2024-04-25 17:39:30 -07:00
Christophe Bornet
7b50fe09ff langchain[patch]: Add async methods to VectorStoreRetrieverMemory (#19408) 2024-04-25 17:39:30 -07:00
Tarun Jain
8f46d05fb1 community[patch]: docarray requires hnsw installation (#19416)
I have a small dataset, and I tried to use docarray:
``DocArrayHnswSearch ``. But when I execute, it returns:

```bash
    raise ImportError(
ImportError: Could not import docarray python package. Please install it with `pip install "langchain[docarray]"`.
```

Instead of docarray it needs to be 

```bash
docarray[hnswlib]
```

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2024-04-25 17:39:30 -07:00
German Swan
a6774bdd39 community[patch]: RecursiveUrlLoader: add base_url option (#19421)
RecursiveUrlLoader does not currently provide an option to set
`base_url` other than the `url`, though it uses a function with such an
option.
For example, this causes it unable to parse the
`https://python.langchain.com/docs`, as it returns the 404 page, and
`https://python.langchain.com/docs/get_started/introduction` has no
child routes to parse.
`base_url` allows setting the `https://python.langchain.com/docs` to
filter by, while the starting URL is anything inside, that contains
relevant links to continue crawling.
I understand that for this case, the docusaurus loader could be used,
but it's a common issue with many websites.

---------

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
2024-04-25 17:39:30 -07:00
Erick Friis
daf727d27f openai[patch]: add test coverage to output (#19462) 2024-04-25 17:39:30 -07:00
igeni
61daabec3b cli[patch]: Modified regular expression (#19449)
- **Description:** Modified regular expression to add support for
unicode chars and simplify pattern

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2024-04-25 17:39:30 -07:00
Ray Bell
b234632b5e docs: point to titantic dataset on web (#19455)
Updated `pd.read_csv("titantic.csv")` to
`pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv")`
i.e. it will read it
https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv
and allow anyone to run the code.

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2024-04-25 17:39:30 -07:00
Ray Bell
b25c5d87db docs: use invoke instead of run (#19457)
Updated the deprecated run with invoke

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2024-04-25 17:39:30 -07:00
Bagatur
25e03040d9 openai[patch]: tool use integration test (#19460) 2024-04-25 17:39:30 -07:00
Erick Friis
6bfdff460a openai[patch]: integration test structured output (#19459) 2024-04-25 17:39:30 -07:00
Erick Friis
84900350fa openai[patch]: release 0.1.1 (#19458) 2024-04-25 17:39:30 -07:00
Luca Dorigo
257788759a openai[patch]: [URGENT REGRESSION FIX] Don't fail if tool message already doesn't contain name (#19435)
- [ ] **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.

---------

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
2024-04-25 17:39:30 -07:00
aditya thomas
685c7e4bcb docs: delete mistralai embeddings doc from incorrect location (#19432)
**Description:** Delete MistralAIEmbeddings usage document from folder
partners/mistralai/docs
**Issue:** The document is present in the folder docs/docs
**Dependencies:** None
2024-04-25 17:39:30 -07:00
Erick Friis
1b78d3b920 mistralai[patch]: fix core version (#19454) 2024-04-25 17:39:30 -07:00
Erick Friis
b9c7c96a1a mistralai[patch]: release 0.1.0rc1 (#19453) 2024-04-25 17:39:30 -07:00
aditya thomas
d7c77d4a74 community[patch]: invoke callback prior to yielding token (llama.cpp) (#19392)
**Description:** Invoke callback prior to yielding token for llama.cpp
**Issue:** [Callback for on_llm_new_token should be invoked before the
token is yielded by the model
#16913](https://github.com/langchain-ai/langchain/issues/16913)
**Dependencies:** None
2024-04-25 17:39:30 -07:00
ccurme
a072ff7cad mistralai: update tool calling (#19451)
```python
from langchain.agents import tool
from langchain_mistralai import ChatMistralAI


llm = ChatMistralAI(model="mistral-large-latest", temperature=0)

@tool
def get_word_length(word: str) -> int:
    """Returns the length of a word."""
    return len(word)


tools = [get_word_length]
llm_with_tools = llm.bind_tools(tools)

llm_with_tools.invoke("how long is the word chrysanthemum")
```
currently raises
```
AttributeError: 'dict' object has no attribute 'model_dump'
```

Same with `.with_structured_output`
```python
from langchain_mistralai import ChatMistralAI
from langchain_core.pydantic_v1 import BaseModel

class AnswerWithJustification(BaseModel):
    """An answer to the user question along with justification for the answer."""
    answer: str
    justification: str

llm = ChatMistralAI(model="mistral-large-latest", temperature=0)
structured_llm = llm.with_structured_output(AnswerWithJustification)

structured_llm.invoke("What weighs more a pound of bricks or a pound of feathers")
```

This appears to fix.
2024-04-25 17:39:30 -07:00
Erick Friis
90c68083be cookbook[patch]: add strip of quotes (#19452) 2024-04-25 17:39:30 -07:00
ccurme
a9e792dce2 [langchain] fix OpenAIAssistantRunnable.create_assistant (#19081)
- **Description:** OpenAI assistants support some pre-built tools (e.g.,
`"retrieval"` and `"code_interpreter"`) and expect these as `{"type":
"code_interpreter"}`. This may have been upset by
https://github.com/langchain-ai/langchain/pull/18935
- **Issue:** https://github.com/langchain-ai/langchain/issues/19057
2024-04-25 17:39:30 -07:00
Harrison Chase
361b3d513a core[minor]: Add utility code to create tool examples (#18602)
Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-04-25 17:39:30 -07:00
Erick Friis
9ee9ea2d2e mistralai[minor]: 0.1.0rc0, remove mistral sdk (#19420) 2024-04-25 17:39:30 -07:00
William FH
1f92eaf90d core[patch]: allow "placeholder" type in from_messages tuples (#19152)
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-25 17:39:30 -07:00
billytrend-cohere
1ef0ece204 community[patch]: Replace positional argument with text=text for cohere>=5 compatibility (#19407)
- **Description:** Replace positional argument with text=text for
cohere>=5 compatibility
2024-04-25 17:39:30 -07:00
enfeng
6237b8f791 anthropic[patch]: update base_url of anthropic (#18634)
A small change ~

- [ ] **update base_url**: "package: langchain_anthropic"

---------

Co-authored-by: yangenfeng <yangenfeng@xiaoniangao.com>
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2024-04-25 17:39:30 -07:00
Erick Friis
a3d1919e92 openai[patch]: fix core min version (#19366) 2024-04-25 17:39:30 -07:00
Erick Friis
65a4bb592b openai[patch]: fix name param (#19365) 2024-04-25 17:39:30 -07:00
Erick Friis
106cfe32d5 openai[patch]: release 0.1.0, message id and name support (#19363) 2024-04-25 17:39:30 -07:00
Bagatur
30540aa3aa experimental[patch]: Release 0.0.55 (#19353) 2024-04-25 17:39:30 -07:00
Erick Friis
b28a361418 robocorp[patch]: run integration tests on release (#19358) 2024-04-25 17:39:30 -07:00
Erick Friis
bfdca19e09 robocorp[patch]: release 0.0.4 (#19357) 2024-04-25 17:39:30 -07:00
Bagatur
bad5af16e7 langchain[patch]: Release 0.1.13 (#19351) 2024-04-25 17:39:30 -07:00
Bagatur
dae6f662c4 community[patch]: Release 0.0.29 (#19350) 2024-04-25 17:39:30 -07:00
Bagatur
492d31237c core[patch]: Release 0.1.33 (#19348) 2024-04-25 17:39:29 -07:00
Eugene Yurtsev
1c8ead85a3 langchain[patch]: Add tests for indexing (#19342)
This PR adds tests for the indexing API
2024-04-25 17:39:29 -07:00
William FH
b9b20f6304 [Feat] Accept non-dict if only 1 prompt input variable (#19156)
For prompt templates with only 1 variable (common in e.g.,
MessageGraph), it's convenient to wrap the incoming object in the
variable before formatting.


The downside of this, of course, would be that some number of
invocations will successfully format when the user may have intended to
format it properly before
2024-04-25 17:39:29 -07:00
mackong
fadc4b0a8a langchain[patch]: add stop for various non-openai agents (#19333)
* Description: add stop for various non-openai agents.
* Issue: N/A
* Dependencies: N/A

---------

Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
2024-04-25 17:39:29 -07:00
Yudhajit Sinha
492efd5f30 community[patch]: Invoke callback prior to yielding token (titan_takeoff_pro) (#18624)
## PR title
community[patch]: Invoke callback prior to yielding token

## PR message
- Description: Invoke callback prior to yielding token in _stream_
method in llms/titan_takeoff_pro.
- Issue: #16913 
- Dependencies: None
2024-04-25 17:39:29 -07:00
Yudhajit Sinha
9321d1268c community[patch]: Invoke callback prior to yielding token (sparkllm) (#18625)
## PR title
community[patch]: Invoke callback prior to yielding token

## PR message
- Description: Invoke callback prior to yielding token in _stream_
method in llms/sparkllm.
- Issue: #16913 
- Dependencies: None
2024-04-25 17:39:29 -07:00