Content-Length: 319351 | pFad | http://github.com/github/codespaces-models/pull/10/commits/516b3447a8566c42ca297d0b9953cf6d38cef539

D9 Update to Mistral Python SDK v1.0.1 by mor10 · Pull Request #10 · github/codespaces-models · GitHub
Skip to content

Update to Mistral Python SDK v1.0.1 #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update minstral client in function_calling.ipynb
  • Loading branch information
mor10 committed Aug 12, 2024
commit 516b3447a8566c42ca297d0b9953cf6d38cef539
14 changes: 6 additions & 8 deletions cookbooks/python/mistralai/function_calling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@
"metadata": {},
"outputs": [],
"source": [
"from mistralai.models.chat_completion import ChatMessage\n",
"from mistralai import Mistral\n",
"\n",
"messages = [\n",
" ChatMessage(role=\"user\", content=\"What's the status of my transaction T1001?\")\n",
" {\"role\":\"user\", \"content\":\"What's the status of my transaction T1001?\"}\n",
"]\n"
]
},
Expand All @@ -214,13 +214,11 @@
"metadata": {},
"outputs": [],
"source": [
"from mistralai.client import MistralClient\n",
"\n",
"model = \"mistral-large\"\n",
"\n",
"client = MistralClient(api_key=github_token, endpoint=endpoint)\n",
"client = Mistral(api_key=github_token, server_url=endpoint)\n",
"\n",
"response = client.chat(\n",
"response = client.chat.complete(\n",
" model=model,\n",
" messages=messages,\n",
" tools=tools,\n",
Expand Down Expand Up @@ -294,7 +292,7 @@
"metadata": {},
"outputs": [],
"source": [
"messages.append(ChatMessage(role=\"tool\", name=function_name, content=function_result, tool_call_id=tool_call.id))"
"messages.append({\"role\":\"tool\", \"name\":function_name, \"content\":function_result, \"tool_call_id\":tool_call.id})"
]
},
{
Expand Down Expand Up @@ -324,7 +322,7 @@
"metadata": {},
"outputs": [],
"source": [
"response = client.chat(\n",
"response = client.chat.complete(\n",
" model=model,\n",
" messages=messages\n",
")\n",
Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/github/codespaces-models/pull/10/commits/516b3447a8566c42ca297d0b9953cf6d38cef539

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy