mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
c4599444ee
```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. |
||
---|---|---|
.. | ||
ai21 | ||
airbyte | ||
anthropic | ||
astradb | ||
elasticsearch | ||
exa | ||
fireworks | ||
google-genai | ||
google-vertexai | ||
groq | ||
ibm | ||
mistralai | ||
mongodb | ||
nomic | ||
nvidia-ai-endpoints | ||
nvidia-trt | ||
openai | ||
pinecone | ||
robocorp | ||
together | ||
voyageai |