Commit Graph

346 Commits

Author SHA1 Message Date
Bagatur
799714c629
release anthropic, fireworks, openai, groq, mistral (#20333) 2024-04-11 09:19:52 -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
Bagatur
c706689413
openai[patch]: use tool_calls in request (#20272) 2024-04-11 03:55:52 -07:00
Erick Friis
0fa551c278
chroma: bump rc, keep optional (#20298) 2024-04-10 14:22:56 -07:00
Erick Friis
16f8fff14f
chroma: add required fastapi dep to restrict to <1 (#20297) 2024-04-10 14:16:13 -07:00
Erick Friis
991fd82532
chroma: add optional fastapi dep to restrict to <1 (#20295) 2024-04-10 12:49:44 -07:00
killind-dev
f8a54d1d73
chroma: Add chroma partner package (#19292)
**Description:** Adds chroma to the partners package. Tests & code
mirror those in the community package.
**Dependencies:** None
**Twitter handle:** @akiradev0x

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-10 19:33:45 +00:00
Yuki Oshima
12190ad728
openai[patch]: Fix langchain-openai unknown parameter error with gpt-4-turbo (#20271)
**Description:** 

I fixed langchain-openai unknown parameter error with gpt-4-turbo.

It seems that the behavior of the Chat Completions API implicitly
changed when using the latest gpt-4-turbo model, differing from previous
models. It now appears to reject parameters that are not listed in the
[API
Reference](https://platform.openai.com/docs/api-reference/chat/create).
So I found some errors and fixed them.

**Issue:** https://github.com/langchain-ai/langchain/issues/20264

**Dependencies:** none

**Twitter handle:** https://twitter.com/oshima_123
2024-04-10 09:51:38 -07:00
Erick Friis
9eb6f538f0
infra, multiple: rc release versions (#20252) 2024-04-09 17:54:58 -07:00
Bagatur
0d0458d1a7
mistralai[patch]: Pre-release 0.1.2-rc.1 (#20251) 2024-04-10 00:25:38 +00:00
Bagatur
e4046939d0
anthropic[patch]: Pre-release 0.1.8-rc.1 (#20250) 2024-04-10 00:23:10 +00:00
Bagatur
a8eb0f5b1b
openai[patch]: pre-release 0.1.3-rc.1 (#20249) 2024-04-10 00:22:08 +00:00
Bagatur
9514bc4d67
core[minor], ...: add tool calls message (#18947)
core[minor], langchain[patch], openai[minor], anthropic[minor], fireworks[minor], groq[minor], mistralai[minor]

```python
class ToolCall(TypedDict):
    name: str
    args: Dict[str, Any]
    id: Optional[str]

class InvalidToolCall(TypedDict):
    name: Optional[str]
    args: Optional[str]
    id: Optional[str]
    error: Optional[str]

class ToolCallChunk(TypedDict):
    name: Optional[str]
    args: Optional[str]
    id: Optional[str]
    index: Optional[int]


class AIMessage(BaseMessage):
    ...
    tool_calls: List[ToolCall] = []
    invalid_tool_calls: List[InvalidToolCall] = []
    ...


class AIMessageChunk(AIMessage, BaseMessageChunk):
    ...
    tool_call_chunks: Optional[List[ToolCallChunk]] = None
    ...
```
Important considerations:
- Parsing logic occurs within different providers;
- ~Changing output type is a breaking change for anyone doing explicit
type checking;~
- ~Langsmith rendering will need to be updated:
https://github.com/langchain-ai/langchainplus/pull/3561~
- ~Langserve will need to be updated~
- Adding chunks:
- ~AIMessage + ToolCallsMessage = ToolCallsMessage if either has
non-null .tool_calls.~
- Tool call chunks are appended, merging when having equal values of
`index`.
  - additional_kwargs accumulate the normal way.
- During streaming:
- ~Messages can change types (e.g., from AIMessageChunk to
AIToolCallsMessageChunk)~
- Output parsers parse additional_kwargs (during .invoke they read off
tool calls).

Packages outside of `partners/`:
- https://github.com/langchain-ai/langchain-cohere/pull/7
- https://github.com/langchain-ai/langchain-google/pull/123/files

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-04-09 18:41:42 -05:00
Erick Friis
00552918ac
groq: xfail tool_choice tests (#20247) 2024-04-09 23:29:59 +00:00
Bagatur
f06cb59ab9
groq[patch]: Release 0.1.1 (#20242) 2024-04-09 21:59:58 +00:00
Bagatur
0b2f0307d7
openai[patch]: Release 0.1.2 (#20241) 2024-04-09 21:55:19 +00:00
Bagatur
4b84c9b28c
anthropic[patch]: Release 0.1.7 (#20240) 2024-04-09 21:53:16 +00:00
Bagatur
74d04a4e80
mistralai[patch]: Release 0.1.1 (#20239) 2024-04-09 21:53:01 +00:00
Erick Friis
855ba46f80
standard-tests: a standard unit and integration test set (#20182)
just chat models for now
2024-04-09 12:43:00 -07:00
Erick Friis
9b5cae045c
together: release 0.1.0 (#20225)
Resolved #20217
2024-04-09 12:23:52 -07:00
Eugene Yurtsev
7cfb643a1c
langchain-postgres: Remove remaining README.md file (#20221)
Repository has moved to langchain-ai/langchain-postgres
2024-04-09 14:02:15 -04:00
Eugene Yurtsev
2fa7266ebb
Remove postgres package (#20207)
Package moved
2024-04-09 13:51:17 -04:00
Simon Kelly
a682f0d12b
openai[patch]: wrap stream code in context manager blocks (#18013)
**Description:**
Use the `Stream` context managers in `ChatOpenAi` `stream` and `astream`
method.

Using the context manager returned by the OpenAI client makes it
possible to terminate the stream early since the response connection
will be closed when the context manager exists.

**Issue:** #5340
**Twitter handle:** @snopoke

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2024-04-09 17:40:16 +00:00
kaijietti
a812839f0c
community: add request_timeout and max_retries to ChatAnthropic (#19402)
This PR make `request_timeout` and `max_retries` configurable for
ChatAnthropic.

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-08 21:04:17 +00:00
Erick Friis
391e8f2050
pinecone[patch]: fix core min version (#20177) 2024-04-08 20:06:59 +00:00
Harry Jiang
1ee208541c
langchain: fix pinecone upsert when async_req is set to False (#19793)
Issue: 
When async_req is the default value True, pinecone client return the
multiprocessing AsyncResult object.
When async_req is set to False, pinecone client return the result
directly. `[{'upserted_count': 1}]` . Calling get() method will throw an
error in this case.
2024-04-08 12:55:59 -07:00
Bagatur
a27d88f12a
anthropic[patch]: standardize init args (#20161)
Related to #20085
2024-04-08 12:09:06 -05:00
Bagatur
3490d70238
mistralai[patch]: standardize model params (#20163)
Related to #20085
2024-04-08 11:48:38 -05:00
Bagatur
5ae0e687b3
docs: use standard openai params (#20160)
Part of #20085
2024-04-08 10:56:53 -05:00
Eugene Yurtsev
34a24d4df6
postgres[minor]: Add pgvector community as is (#20096)
This moves langchain pgvector community as is

The only modification is support for psycopg3 rather than psycopg2!
2024-04-08 09:34:10 -04:00
Eugene Yurtsev
ba9e0d76c1
postgres[minor]: add postgres checkpoint implementation (#20025)
Adds checkpoint implementation using psycopg
2024-04-08 09:27:15 -04:00
Erick Friis
96dc0ea49d
pinecone[patch]: release 0.1.0 (#20109) 2024-04-06 18:41:28 +00:00
Maxime Perrin
5ac0d1f67b
partners[anthropic]: fix anthropic chat model message type lookup keys (#19034)
- **Description:** Fixing message formatting issue in ChatAnthropic
model by adding dictionary keys for `AIMessageChunk `and
`HumanMessageChunk`
  - **Issue:** #19025 
  - **Twitter handle:** @maximeperrin_

Co-authored-by: Maxime Perrin <mperrin@doing.fr>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-06 00:22:14 +00:00
Bagatur
46f580d42d
docs: anthropic tool docstring (#20091) 2024-04-05 21:50:40 +00:00
Erick Friis
28dfde2cb2
cohere: move package to external repo (#20081) 2024-04-05 14:29:15 -07:00
Bagatur
1b7ed6071a
anthropic[patch]: Release 0.1.6 (#20026) 2024-04-04 14:29:50 -07:00
Bagatur
6860450e48
anthropic[patch]: use anthropic 0.23 (#20022) 2024-04-04 14:23:53 -07:00
Bagatur
be3dd62de4
anthropic[patch]: fix experimental tests (#20021) 2024-04-04 13:37:43 -07:00
Bagatur
86fdb79454
anthropic[patch]: bump core dep (#20019)
]
2024-04-04 13:28:23 -07:00
Bagatur
209de0a561
anthropic[minor]: tool use (#20016) 2024-04-04 13:22:48 -07:00
harry-cohere
e103492eb8
cohere: Add citations to agent, flexibility to tool parsing, fix SDK issue (#19965)
**Description:** Citations are the main addition in this PR. We now emit
them from the multihop agent! Additionally the agent is now more
flexible with observations (`Any` is now accepted), and the Cohere SDK
version is bumped to fix an issue with the most recent version of
pydantic v1 (1.10.15)
2024-04-04 07:02:30 -07:00
Erick Friis
51bdfe04e9
groq: handle streaming tool call case (#19978) 2024-04-03 15:22:59 -07:00
Erick Friis
5acb564d6f
groq: fix core version (#19976) 2024-04-03 14:49:57 -07:00
Erick Friis
9e60159043
groq: release 0.1.0 (#19975) 2024-04-03 14:41:48 -07:00
Graden Rea
88cf8a2905
groq: Add tool calling support (#19971)
**Description:** Add with_structured_output to groq chat models
**Issue:** 
**Dependencies:** N/A
**Twitter handle:** N/A
2024-04-03 14:40:20 -07:00
Eugene Yurtsev
d6d843ec24
langchain-postgres: Initial package with postgres chat history implementation (#19884)
- [x] Add in code examples for the chat message history class
- [ ] ~Add docs with notebook examples~ (can this be done later?)
- [x] Update README.md
2024-04-03 10:57:21 -04:00
Erick Friis
d5a2ff58e9
pinecone[patch]: source tag (#19739) 2024-04-02 19:53:59 +00:00
harry-cohere
beab9adffb
cohere: Improve integration test stability, fix documents bug (#19929)
**Description**: Improves the stability of all Cohere partner package
integration tests. Fixes a bug with document parsing (both dicts and
Documents are handled).
2024-04-02 11:22:30 -07:00
harry-cohere
37fc1c525a
cohere: simplify integration test (#19928)
**Description**: This PR simplifies an integration test within the
Cohere partner package:
 * It no longer relies on exact model answers
 * It no longer relies on a third party tool
2024-04-02 10:57:25 -07:00
billytrend-cohere
de6c0cf248
cohere, docs: update imports and installs to langchain_cohere (#19918)
cohere: update imports and installs to langchain_cohere

---------

Co-authored-by: Harry M <127103098+harry-cohere@users.noreply.github.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-02 09:47:58 -07:00