langchain/libs
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
..
cli cli[minor]: Add disable sockets in unit tests (#19877) 2024-04-03 17:17:50 -04:00
community community[patch]: Add deprecation warnings to postgres implementation (#20222) 2024-04-11 10:33:22 -04:00
core mistral[patch]: add IDs to tool calls (#20299) 2024-04-11 11:09:30 -04:00
experimental experimental[patch]: Release 0.0.57 (#20243) 2024-04-09 17:08:01 -05:00
langchain langchain[patch]: agents check prompt partial vars (#20303) 2024-04-11 03:55:09 -07:00
partners mistral[patch]: add IDs to tool calls (#20299) 2024-04-11 11:09:30 -04:00
standard-tests standard-tests: a standard unit and integration test set (#20182) 2024-04-09 12:43:00 -07:00
text-splitters text-splitters[minor]: Adding a new section aware splitter to langchain (#16526) 2024-04-01 20:32:26 +00:00