Commit Graph

8769 Commits

Author SHA1 Message Date
Bagatur
f1248f8d9a
core[patch]: configurable init params (#20070)
Proposed fix for #20061. need to test

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-12 21:18:43 +00:00
Eugene Yurtsev
4808441d29
Docs: Add guide for implementing custom retriever (#20350)
Add longer guide for implementing custom retriever.

---------

Co-authored-by: ccurme <chester.curme@gmail.com>
2024-04-12 17:18:35 -04:00
aditya thomas
4f75b230ed
partner[ai21]: masking of the api key for ai21 models (#20257)
**Description:** Masking of the API key for AI21 models
**Issue:** Fixes #12165 for AI21
**Dependencies:** None

Note: This fix came in originally through #12418 but was possibly missed
in the refactor to the AI21 partner package


---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-12 20:19:31 +00:00
Leonid Ganeline
e512d3c6a6
langchain: callbacks imports fix (#20348)
Replaced all `from langchain.callbacks` into `from
langchain_core.callbacks` .
Changes in the `langchain` and `langchain_experimental`

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-12 20:13:14 +00:00
Erick Friis
d83b720c40
templates: readme langsmith not private beta (#20173) 2024-04-12 13:08:10 -07:00
michael
525226fb0b
docs: fix extraction/quickstart.ipynb example code (#20397)
- **Description**: The pydantic schema fields are supposed to be
optional but the use of `...` makes them required. This causes a
`ValidationError` when running the example code. I replaced `...` with
`default=None` to make the fields optional as intended. I also
standardized the format for all fields.
- **Issue**: n/a
- **Dependencies**: none
- **Twitter handle**: https://twitter.com/m_atoms

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-04-12 19:59:32 +00:00
balloonio
e7b1a44c5b
community[patch]: Invoke callback prior to yielding token fix for Llamafile (#20365)
- [x] **PR title**: community[patch]: Invoke callback prior to yielding
token fix for Llamafile


- [x] **PR message**: 
- **Description:** Invoke callback prior to yielding token in stream
method in community llamafile.py
    - **Issue:** https://github.com/langchain-ai/langchain/issues/16913
    - **Dependencies:** None
    - **Twitter handle:** @bolun_zhang

If no one reviews your PR within a few days, please @-mention one of
baskaryan, efriis, eyurtsev, hwchase17.
2024-04-12 19:26:12 +00:00
milind
1b272fa2f4
Update index.mdx (#20395)
spelling error fixed

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.
2024-04-12 19:22:08 +00:00
balloonio
93caa568f9
community[patch]: Invoke callback prior to yielding token fix for HuggingFaceEndpoint (#20366)
- [x] **PR title**: community[patch]: Invoke callback prior to yielding
token fix for HuggingFaceEndpoint


- [x] **PR message**: 
- **Description:** Invoke callback prior to yielding token in stream
method in community HuggingFaceEndpoint
    - **Issue:** https://github.com/langchain-ai/langchain/issues/16913
    - **Dependencies:** None
    - **Twitter handle:** @bolun_zhang

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

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-04-12 19:16:34 +00:00
Nicolas
ad04585e30
community[minor]: Firecrawl.dev integration (#20364)
Added the [FireCrawl](https://firecrawl.dev) document loader. Firecrawl
crawls and convert any website into LLM-ready data. It crawls all
accessible subpages and give you clean markdown for each.

    - **Description:** Adds FireCrawl data loader
    - **Dependencies:** firecrawl-py
    - **Twitter handle:** @mendableai 

ccing contributors: (@ericciarla @nickscamara)

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2024-04-12 19:13:48 +00:00
Tomaz Bratanic
a1b105ac00
experimental[patch]: Skip pydantic validation for llm graph transformer and fix JSON response where possible (#19915)
LLMs might sometimes return invalid response for LLM graph transformer.
Instead of failing due to pydantic validation, we skip it and manually
check and optionally fix error where we can, so that more information
gets extracted
2024-04-12 11:29:25 -07:00
Erick Friis
20f5cd7c95
docs: langchain-chroma package (#20394) 2024-04-12 11:17:05 -07:00
Haris Ali
6786fa9186
docs: Adding api documentation link at the end of each output parser class description page. (#20391)
- **Description:** Added cross-links for easy access of api
documentation of each output parser class from it's description page.
  - **Issue:** related to issue #19969

Co-authored-by: Haris Ali <haris.ali@formulatrix.com>
2024-04-12 17:58:18 +00:00
P. Taylor Goetz
9317df7f16
community[patch]: Add "model" attribute to the payload sent to Ollama in ChatOllama (#20354)
Example Ollama API calls:

Request without "model":
```
curl --location 'http://localhost:11434/api/chat' \
--header 'Content-Type: application/json' \
--data '{
  "messages": [
    {
      "role": "user",
      "content": "What is the capitol of PA?"
    }
  ],
  "stream": false
}'
```
Response:
```
{"error":"model is required"}
```

Request with "model":
```
curl --location 'http://localhost:11434/api/chat' \
--header 'Content-Type: application/json' \
--data '{
  "model": "openchat",
  "messages": [
    {
      "role": "user",
      "content": "What is the capitol of PA?"
    }
  ],
  "stream": false
}'
```

Response:
```
{
  "eval_duration" : 733248000,
  "created_at" : "2024-04-11T23:04:08.735766843Z",
  "model" : "openchat",
  "message" : {
    "content" : " The capital city of Pennsylvania is Harrisburg.",
    "role" : "assistant"
  },
  "total_duration" : 3138731168,
  "prompt_eval_count" : 25,
  "load_duration" : 466562959,
  "done" : true,
  "prompt_eval_duration" : 1938495000,
  "eval_count" : 10
}
```
2024-04-12 13:32:53 -04:00
Bagatur
57bb940c17
docs: vertexai tool call update (#20362) 2024-04-12 10:09:54 -07:00
Alex Sherstinsky
fad0962643
community: for Predibase -- enable both Predibase-hosted and HuggingFace-hosted fine-tuned adapter repositories (#20370) 2024-04-12 08:32:00 -07:00
ccurme
5395c409cb
docs: add Cohere to ChatModelTabs (#20386) 2024-04-12 10:35:10 -04:00
Eugene Yurtsev
6470b30173
langchain[patch]: Add deprecation warning to extraction chains (#20224)
Add deprecation warnings to extraction chains
2024-04-12 10:24:32 -04:00
Eugene Yurtsev
b65a1d4cfd
langchain[patch]: Add another unit test for indexing code (#20387)
Add another unit test for indexing
2024-04-12 10:19:18 -04:00
Erick Friis
29282371db
core: bind_tools interface on basechatmodel (#20360) 2024-04-12 01:32:19 +00:00
Erick Friis
e6806a08d4
multiple: standard chat model tests (#20359) 2024-04-11 18:23:13 -07:00
Bagatur
f78564d75c
docs: show tool msg in tool call docs (#20358) 2024-04-11 16:42:04 -07:00
Isak Nyberg
bac9fb9a7c
community: add gpt-4 pricing in callback (#20292)
Added the pricing for `gpt-4-turbo` and `gpt-4-turbo-2024-04-09` in the
callback method.
related to issue #17173 

https://openai.com/pricing#language-models
2024-04-11 18:02:39 -04:00
Ikko Eltociear Ashimine
cb29b42285
docs: Update ibm_watsonx.ipynb (#20329)
avaliable -> available


    - **Description:** fixed typo
    - **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!
2024-04-11 17:59:23 -04:00
Jack Wotherspoon
204a16addc
docs: add Cloud SQL for MySQL vector store integration docs (#20278)
Adding docs page for `Google Cloud SQL for MySQL` vector store
integration. This was recently released as part of the Cloud SQL for
MySQL LangChain package
([release](https://github.com/googleapis/langchain-google-cloud-sql-mysql-python/releases/tag/v0.2.0))

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-11 21:57:46 +00:00
Leonid Ganeline
7cf2d2759d
community[patch]: docstrings update (#20301)
Added missed docstrings. Format docstings to the consistent form.
2024-04-11 16:23:27 -04:00
Eugene Yurtsev
2900720cd3
core[patch]: Update documentation for base retriever (#20345)
Updating in code documentation for base retriever to direct folks toward
the .invoke and .ainvoke methods + explain how to implement
2024-04-11 16:20:14 -04:00
Bagatur
d2f4153fe6
docs: tool call nits (#20356) 2024-04-11 12:56:36 -07:00
Bagatur
eafd8c580b
docs: tool agent nit (#20353) 2024-04-11 19:41:31 +00:00
Erick Friis
ec0273fc92
chroma: release 0.1.0 (#20355) 2024-04-11 12:39:52 -07:00
Bagatur
a889cd14f3
docs: use vertexai in chat model tabs (#20352) 2024-04-11 12:34:19 -07:00
Bagatur
9d302c1b57
docs: update anthropic tool call (#20344) 2024-04-11 11:38:26 -07:00
Erick Friis
da707d0755
chroma: remove relevance score int test (#20346)
deprecating feature in #20302
2024-04-11 11:29:33 -07:00
Eugene Yurtsev
de938a4451
docs: Update chat model providers include package information (#20336)
Include package information
2024-04-11 13:29:42 -04:00
Bagatur
56fe4ab382
docs: update tool-calling table (#20338) 2024-04-11 09:50:20 -07:00
Bagatur
43a98592c1
docs: tool agent nit (#20337) 2024-04-11 09:43:12 -07:00
Bagatur
562b546bcc
docs: update chat openai (#20331) 2024-04-11 09:29:46 -07:00
Bagatur
2c4741b5ed
docs: add tool-calling agent (#20328) 2024-04-11 09:29:40 -07:00
ccurme
f02e55aaf7
docs: add component page for tool calls (#20282)
Note: includes links to API reference pages for ToolCall and other
objects that currently don't exist (e.g.,
https://api.python.langchain.com/en/latest/messages/langchain_core.messages.tool.ToolCall.html#langchain_core.messages.tool.ToolCall).
2024-04-11 09:29:25 -07:00
Bagatur
6608089030
langchain[patch]: Release 0.1.16 (#20335) 2024-04-11 09:28:37 -07:00
Eugene Yurtsev
0e74fb4ec1
docs: Update list of chat models tool calling providers (#20330)
Will follow up with a few missing providers
2024-04-11 12:22:49 -04:00
Eugene Yurtsev
653489a1a9
docs: Update documentation for custom LLMs (#19972)
Update documentation for customizing LLMs
2024-04-11 12:21:27 -04:00
Bagatur
799714c629
release anthropic, fireworks, openai, groq, mistral (#20333) 2024-04-11 09:19:52 -07:00
Bagatur
e72330aacc
core[patch]: Release 0.1.42 (#20332) 2024-04-11 09:10:27 -07:00
ccurme
795c728f71
mistral[patch]: add IDs to tool calls (#20299)
Mistral gives us one ID per response, no individual IDs for tool calls.

```python
from langchain.agents import AgentExecutor, create_tool_calling_agent, tool
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_mistralai import ChatMistralAI


prompt = ChatPromptTemplate.from_messages(
    [
        ("system", "You are a helpful assistant"),
        ("human", "{input}"),
        MessagesPlaceholder("agent_scratchpad"),
    ]
)
model = ChatMistralAI(model="mistral-large-latest", temperature=0)

@tool
def magic_function(input: int) -> int:
    """Applies a magic function to an input."""
    return input + 2

tools = [magic_function]

agent = create_tool_calling_agent(model, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)

agent_executor.invoke({"input": "what is the value of magic_function(3)?"})
```

---------

Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
2024-04-11 11:09:30 -04:00
Eugene Yurtsev
22fd844e8a
community[patch]: Add deprecation warnings to postgres implementation (#20222)
Add deprecation warnings to postgres implementation that are in langchain-postgres.
2024-04-11 10:33:22 -04:00
Eugene Yurtsev
f02f708f52
core[patch]: For now remove user warning (#20321)
Remove warning since it creates a lot of noise.
2024-04-11 10:33:01 -04:00
Mayank Solanki
f709ab4cdf
docs: added backtick on RunnablePassthrough (#20310)
added backtick on RunnablePassthrough
Isuue: #20094
2024-04-11 08:39:10 -04:00
Bagatur
c706689413
openai[patch]: use tool_calls in request (#20272) 2024-04-11 03:55:52 -07:00
Bagatur
e936fba428
langchain[patch]: agents check prompt partial vars (#20303) 2024-04-11 03:55:09 -07:00