mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-15 07:36:08 +00:00
docs: fireworks tool calling docs (#18057)
This commit is contained in:
parent
e566a3077e
commit
e85948d46b
@ -140,10 +140,58 @@
|
|||||||
"chat.invoke([system_message, human_message])"
|
"chat.invoke([system_message, human_message])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "8c44cb36",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"# Tool Calling\n",
|
||||||
|
"\n",
|
||||||
|
"Fireworks offers the [`FireFunction-v1` tool calling model](https://fireworks.ai/blog/firefunction-v1-gpt-4-level-function-calling). You can use it for structured output and function calling use cases:"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 11,
|
||||||
|
"id": "ee2db682",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"{'function': {'arguments': '{\"name\": \"Erick\", \"age\": 27}',\n",
|
||||||
|
" 'name': 'ExtractFields'},\n",
|
||||||
|
" 'id': 'call_J0WYP2TLenaFw3UeVU0UnWqx',\n",
|
||||||
|
" 'index': 0,\n",
|
||||||
|
" 'type': 'function'}\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"from pprint import pprint\n",
|
||||||
|
"\n",
|
||||||
|
"from langchain_core.pydantic_v1 import BaseModel\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"class ExtractFields(BaseModel):\n",
|
||||||
|
" name: str\n",
|
||||||
|
" age: int\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"chat = ChatFireworks(\n",
|
||||||
|
" model=\"accounts/fireworks/models/firefunction-v1\",\n",
|
||||||
|
").bind_tools([ExtractFields])\n",
|
||||||
|
"\n",
|
||||||
|
"result = chat.invoke(\"I am a 27 year old named Erick\")\n",
|
||||||
|
"\n",
|
||||||
|
"pprint(result.additional_kwargs[\"tool_calls\"][0])"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "8c44cb36",
|
"id": "2321a4e6",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": []
|
"source": []
|
||||||
|
Loading…
Reference in New Issue
Block a user