Skip to content

The agent engineering platform.

docs: fireworks tool calling docs (#18057)

Erick Friise85948d46bab
diff --git a/docs/docs/integrations/chat/fireworks.ipynb b/docs/docs/integrations/chat/fireworks.ipynb
index ec9a9d3962..8cee725511 100644
--- a/docs/docs/integrations/chat/fireworks.ipynb
+++ b/docs/docs/integrations/chat/fireworks.ipynb
@@ -140,10 +140,58 @@
"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",
"execution_count": null,
- "id": "8c44cb36",
+ "id": "2321a4e6",
"metadata": {},
"outputs": [],
"source": []