forked from mistralai/mistral-inference
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFunction calling _ Mistral AI Large Language Models.html
87 lines (85 loc) · 130 KB
/
Function calling _ Mistral AI Large Language Models.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<!-- saved from url=(0054)https://docs.mistral.ai/capabilities/function_calling/ -->
<html lang="en" dir="ltr" class="docs-wrapper plugin-docs plugin-id-default docs-version-current docs-doc-page docs-doc-id-capabilities/function_calling" data-has-hydrated="true" data-google-analytics-opt-out="" data-bybit-channel-name="DM9imwGZgT5ugUyEqwL-f" data-bybit-is-default-wallet="true" data-theme="dark" data-rh="lang,dir,class,data-has-hydrated"><div id="in-page-channel-node-id" data-channel-name="in_page_channel_RxGQkH"></div><script async="false" src="chrome-extension://cpmkedoipcpimgecpmgpldfpohjplkpp/window-provider.js"></script><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="Docusaurus v3.2.1">
<title>Function calling | Mistral AI Large Language Models</title><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:image" content="https://docs.mistral.ai/img/mistral-social-banner.jpg"><meta data-rh="true" name="twitter:image" content="https://docs.mistral.ai/img/mistral-social-banner.jpg"><link data-rh="true" rel="icon" href="https://docs.mistral.ai/img/favicon.ico"><link rel="stylesheet" href="./Function calling _ Mistral AI Large Language Models_files/styles.5760d859.css">
<script src="./Function calling _ Mistral AI Large Language Models_files/runtime~main.77a48988.js.download" defer="defer"></script>
<script src="./Function calling _ Mistral AI Large Language Models_files/main.0b370f62.js.download" defer="defer"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" data-rh="true"><meta property="og:locale" content="en" data-rh="true"><meta name="docusaurus_locale" content="en" data-rh="true"><meta name="docsearch:language" content="en" data-rh="true"><meta name="docusaurus_version" content="current" data-rh="true"><meta name="docusaurus_tag" content="docs-default-current" data-rh="true"><meta name="docsearch:version" content="current" data-rh="true"><meta name="docsearch:docusaurus_tag" content="docs-default-current" data-rh="true"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a811ed6a.32154ebd.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/02cb9835.2cd530c2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/7ccb0d94.d8b3d864.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/99938c86.a7f99cbb.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/045b7d00.268e7a7d.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/e015390e.98ed70ba.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/3f130913.0e0f4a08.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/f4834277.97d3d249.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/35155c61.3db4251e.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/f0ad3fbb.5feefe83.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/3c469c15.bb053fda.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/b3ecb6b5.ba27041d.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/f327c38b.f599bea6.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/7c146eec.d61c7e13.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/1ae8728a.f7d8de3a.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/00498170.241ece43.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/2ddf178c.cad62e22.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/c1e31d33.be447d0d.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/ef65460b.3a312f0f.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/d18bf588.f58ff7f7.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/e921f177.0d1ec9d9.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/47a2a88f.30dfc23f.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/5e95c892.2d7483fa.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/87c49e91.b3570ff1.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a7bd4aaa.690b4ba5.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/935f2afb.7c098d79.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/a94703ab.2132f644.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/54481e7f.7d2be6e2.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/17896441.fdb7390c.js"><link rel="prefetch" href="https://docs.mistral.ai/assets/js/306f7620.a35c7954.js"><link rel="canonical" href="https://docs.mistral.ai/capabilities/function_calling/" data-rh="true"><link rel="alternate" href="https://docs.mistral.ai/capabilities/function_calling/" hreflang="en" data-rh="true"><link rel="alternate" href="https://docs.mistral.ai/capabilities/function_calling/" hreflang="x-default" data-rh="true"><meta property="og:url" content="https://docs.mistral.ai/capabilities/function_calling/" data-rh="true"><meta property="og:title" content="Function calling | Mistral AI Large Language Models" data-rh="true"><meta name="description" content="Function calling allows Mistral models to connect to external tools. By integrating Mistral models with external tools such as user defined functions or APIs, users can easily build applications catering to specific use cases and practical problems. In this guide, for instance, we wrote two functions for tracking payment status and payment date. We can use these two tools to provide answers for payment-related queries." data-rh="true"><meta property="og:description" content="Function calling allows Mistral models to connect to external tools. By integrating Mistral models with external tools such as user defined functions or APIs, users can easily build applications catering to specific use cases and practical problems. In this guide, for instance, we wrote two functions for tracking payment status and payment date. We can use these two tools to provide answers for payment-related queries." data-rh="true"></head>
<body class="" data-rh="class" style="overflow: visible;">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return localStorage.getItem("theme")}catch(t){}}();null!==e?t(e):window.matchMedia("(prefers-color-scheme: dark)").matches?t("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,t("light"))}(),function(){try{const c=new URLSearchParams(window.location.search).entries();for(var[t,e]of c)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}()</script><div id="__docusaurus"><div role="region" aria-label="Skip to main content"><a class="skipToContent_yC05" href="https://docs.mistral.ai/capabilities/function_calling/#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://mistral.ai/" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="./Function calling _ Mistral AI Large Language Models_files/logo-dark.svg" alt="Mistral AI Logo" class="themedComponent_hPDO themedComponent--dark_l222"></div></a><a href="https://chat.mistral.ai/" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Le Chat</a><a href="https://console.mistral.ai/" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">La Plateforme</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="https://docs.mistral.ai/">Docs</a><a class="navbar__item navbar__link" href="https://docs.mistral.ai/api/">API</a></div><div class="navbar__items navbar__items--right"><a href="https://github.com/mistralai/" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_yPTG"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.gg/mistralai" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_yPTG"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="toggle_NB6N colorModeToggle_q4rJ"><button class="clean-btn toggleButton_pYLp" type="button" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_mVu4"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_zXrM"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="navbarSearchContainer_cqyf"><div class="navbar__search"><span aria-label="expand searchbar" role="button" class="search-icon" tabindex="0"></span><span class="algolia-autocomplete" style="position: relative; display: inline-block; direction: ltr;"><input id="search_input_react" type="search" placeholder="Search Ctrl+K" aria-label="Search" class="navbar__search-input search-bar ds-input" autocomplete="off" spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-owns="algolia-autocomplete-listbox-0" dir="auto" style="position: relative; vertical-align: top;"><pre aria-hidden="true" style="position: absolute; visibility: hidden; white-space: pre; font-family: Arial; font-size: 12.96px; font-style: normal; font-variant: normal; font-weight: 400; word-spacing: 0px; letter-spacing: normal; text-indent: 0px; text-rendering: auto; text-transform: none;"></pre><span class="ds-dropdown-menu" role="listbox" id="algolia-autocomplete-listbox-0" style="position: absolute; top: 100%; z-index: 100; display: none; left: 0px; right: auto;"><div class="ds-dataset-1"></div></span></span></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_pZGw"><div class="docsWrapper_J1wO"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_nC4L" type="button"></button><div class="docRoot_D4cR"><aside class="theme-doc-sidebar-container docSidebarContainer_Z9Rq"><div class="sidebarViewport__dLE"><div class="sidebar_ava_"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_fHBh"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu-label">Getting Started</li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/">Introduction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/getting-started/quickstart/">Quickstart</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/getting-started/models/">Models</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/getting-started/open_weight_models/">Open-weight models</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/getting-started/clients/">Clients</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/getting-started/changelog/">Changelog</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/getting-started/glossary/">Glossary</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu-label margin-top--md">Capabilities</li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/capabilities/completion/">Text generation</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/capabilities/embeddings/">Embeddings</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" href="https://docs.mistral.ai/capabilities/function_calling/" aria-current="page">Function calling</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/capabilities/json_mode/">JSON mode</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/capabilities/guardrailing/">Guardrailing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu-label margin-top--md">Deployment</li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/deployment/la_plateforme/">La Plateforme</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" href="https://docs.mistral.ai/deployment/cloud/overview/">Cloud</a><button aria-label="Expand sidebar category 'Cloud'" aria-expanded="false" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" href="https://docs.mistral.ai/deployment/self-deployment/overview/">Self-deployment</a><button aria-label="Expand sidebar category 'Self-deployment'" aria-expanded="false" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu-label margin-top--md">Guides</li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/guides/prompting_capabilities/">Prompting capabilities</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/guides/rag/">Basic RAG</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item hidden"><a class="menu__link" href="https://docs.mistral.ai/guides/evaluation/">Evaluation</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/guides/tokenization/">Tokenization</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/guides/resources/">Other resources</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="https://docs.mistral.ai/guides/contribute/">How to contribute</a></li></ul></nav></div></div></aside><main class="docMainContainer_Bgup"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_Td3C"><div class="docItemContainer_REoc"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_E2Xs" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="https://docs.mistral.ai/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_M2Ot"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Function calling</span><meta itemprop="position" content="1"></li></ul></nav><div class="tocCollapsible_QOC6 theme-doc-toc-mobile tocMobile_EF9C"><button type="button" class="clean-btn tocCollapsibleButton_cni4">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Function calling</h1></header><a target="_blank" href="https://colab.research.google.com/github/mistralai/cookbook/blob/main/function_calling.ipynb"><img src="./Function calling _ Mistral AI Large Language Models_files/colab-badge.svg" alt="Open In Colab"></a>
<p>Function calling allows Mistral models to connect to external tools. By integrating Mistral models with external tools such as user defined functions or APIs, users can easily build applications catering to specific use cases and practical problems. In this guide, for instance, we wrote two functions for tracking payment status and payment date. We can use these two tools to provide answers for payment-related queries.</p>
<iframe width="560" height="315" src="./Function calling _ Mistral AI Large Language Models_files/eOo4GfHj3ZE.html" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"></iframe>
<h3 class="anchor anchorWithStickyNavbar_r6n_" id="available-models">Available models<a href="https://docs.mistral.ai/capabilities/function_calling/#available-models" class="hash-link" aria-label="Direct link to Available models" title="Direct link to Available models"></a></h3>
<p>Currently, function calling is available for the following models:</p>
<ul>
<li>Mistral Small</li>
<li>Mistral Large</li>
<li>Mixtral 8x22B</li>
</ul>
<h3 class="anchor anchorWithStickyNavbar_r6n_" id="four-steps">Four steps<a href="https://docs.mistral.ai/capabilities/function_calling/#four-steps" class="hash-link" aria-label="Direct link to Four steps" title="Direct link to Four steps"></a></h3>
<p>At a glance, there are four steps with function calling:</p>
<ul>
<li>User: specify tools and query</li>
<li>Model: Generate function arguments if applicable</li>
<li>User: Execute function to obtain tool results</li>
<li>Model: Generate final answer</li>
</ul>
<img src="./Function calling _ Mistral AI Large Language Models_files/functioncalling1.png" alt="drawing" width="600">
<p>In this guide, we will walk through a simple example to demonstrate how function calling works with Mistral models in these four steps.</p>
<p>Before we get started, let’s assume we have a dataframe consisting of payment transactions. When users ask questions about this dataframe, they can use certain tools to answer questions about this data. This is just an example to emulate an external database that the LLM cannot directly access.</p>
<div class="language-python codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-python codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token keyword" style="color: rgb(102, 217, 239);">import</span><span class="token plain"> pandas </span><span class="token keyword" style="color: rgb(102, 217, 239);">as</span><span class="token plain"> pd</span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain" style="display: inline-block;"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"></span><span class="token comment" style="color: rgb(130, 146, 162); font-style: italic;"># Assuming we have the following data</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">data </span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'transaction_id'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token string" style="color: rgb(166, 226, 46);">'T1001'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'T1002'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'T1003'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'T1004'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'T1005'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'customer_id'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token string" style="color: rgb(166, 226, 46);">'C001'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'C002'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'C003'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'C002'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'C001'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'payment_amount'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token number" style="color: rgb(174, 129, 255);">125.50</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token number" style="color: rgb(174, 129, 255);">89.99</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token number" style="color: rgb(174, 129, 255);">120.00</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token number" style="color: rgb(174, 129, 255);">54.30</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token number" style="color: rgb(174, 129, 255);">210.20</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'payment_date'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token string" style="color: rgb(166, 226, 46);">'2021-10-05'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'2021-10-06'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'2021-10-07'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'2021-10-05'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'2021-10-08'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'payment_status'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token string" style="color: rgb(166, 226, 46);">'Paid'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'Unpaid'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'Paid'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'Paid'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'Pending'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"></span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain" style="display: inline-block;"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"></span><span class="token comment" style="color: rgb(130, 146, 162); font-style: italic;"># Create DataFrame</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">df </span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain"> pd</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">DataFrame</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">data</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<h2 class="anchor anchorWithStickyNavbar_r6n_" id="step-1-user-specify-tools-and-query">Step 1. User: specify tools and query<a href="https://docs.mistral.ai/capabilities/function_calling/#step-1-user-specify-tools-and-query" class="hash-link" aria-label="Direct link to Step 1. User: specify tools and query" title="Direct link to Step 1. User: specify tools and query"></a></h2>
<img src="./Function calling _ Mistral AI Large Language Models_files/functioncalling2.png" alt="drawing" width="600">
<h3 class="anchor anchorWithStickyNavbar_r6n_" id="tools">Tools<a href="https://docs.mistral.ai/capabilities/function_calling/#tools" class="hash-link" aria-label="Direct link to Tools" title="Direct link to Tools"></a></h3>
<p>Users can define all the necessary tools for their use cases.</p>
<ul>
<li>In many cases, we might have multiple tools at our disposal. For example, let’s consider we have two functions as our two tools: <code>retrieve_payment_status</code> and <code>retrieve_payment_date</code> to retrieve payment status and payment date given transaction ID.</li>
</ul>
<div class="language-python codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-python codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token keyword" style="color: rgb(102, 217, 239);">def</span><span class="token plain"> </span><span class="token function" style="color: rgb(230, 219, 116);">retrieve_payment_status</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">df</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> data</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> transaction_id</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token builtin" style="color: rgb(230, 219, 116);">str</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"> </span><span class="token operator" style="color: rgb(102, 217, 239);">-</span><span class="token operator" style="color: rgb(102, 217, 239);">></span><span class="token plain"> </span><span class="token builtin" style="color: rgb(230, 219, 116);">str</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token keyword" style="color: rgb(102, 217, 239);">if</span><span class="token plain"> transaction_id </span><span class="token keyword" style="color: rgb(102, 217, 239);">in</span><span class="token plain"> df</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">transaction_id</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">values</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token keyword" style="color: rgb(102, 217, 239);">return</span><span class="token plain"> json</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">dumps</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token string" style="color: rgb(166, 226, 46);">'status'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> df</span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token plain">df</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">transaction_id </span><span class="token operator" style="color: rgb(102, 217, 239);">==</span><span class="token plain"> transaction_id</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">payment_status</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">item</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token keyword" style="color: rgb(102, 217, 239);">return</span><span class="token plain"> json</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">dumps</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token string" style="color: rgb(166, 226, 46);">'error'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'transaction id not found.'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain" style="display: inline-block;"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"></span><span class="token keyword" style="color: rgb(102, 217, 239);">def</span><span class="token plain"> </span><span class="token function" style="color: rgb(230, 219, 116);">retrieve_payment_date</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">df</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> data</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> transaction_id</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token builtin" style="color: rgb(230, 219, 116);">str</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"> </span><span class="token operator" style="color: rgb(102, 217, 239);">-</span><span class="token operator" style="color: rgb(102, 217, 239);">></span><span class="token plain"> </span><span class="token builtin" style="color: rgb(230, 219, 116);">str</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token keyword" style="color: rgb(102, 217, 239);">if</span><span class="token plain"> transaction_id </span><span class="token keyword" style="color: rgb(102, 217, 239);">in</span><span class="token plain"> df</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">transaction_id</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">values</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token keyword" style="color: rgb(102, 217, 239);">return</span><span class="token plain"> json</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">dumps</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token string" style="color: rgb(166, 226, 46);">'date'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> df</span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token plain">df</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">transaction_id </span><span class="token operator" style="color: rgb(102, 217, 239);">==</span><span class="token plain"> transaction_id</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">payment_date</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">item</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token keyword" style="color: rgb(102, 217, 239);">return</span><span class="token plain"> json</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">dumps</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token string" style="color: rgb(166, 226, 46);">'error'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'transaction id not found.'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<ul>
<li>In order for Mistral models to understand the functions, we need to outline the function specifications with a JSON schema. Specifically, we need to describe the type, function name, function description, function parameters, and the required parameter for the function. Since we have two functions here, let’s list two function specifications in a list.</li>
</ul>
<div class="language-python codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-python codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">tools </span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"type"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"function"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"function"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"name"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"retrieve_payment_status"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"description"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"Get payment status of a transaction"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"parameters"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"type"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"object"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"properties"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"transaction_id"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"type"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"string"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"description"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"The transaction id."</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"required"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token string" style="color: rgb(166, 226, 46);">"transaction_id"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"type"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"function"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"function"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"name"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"retrieve_payment_date"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"description"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"Get payment date of a transaction"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"parameters"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"type"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"object"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"properties"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"transaction_id"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"type"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"string"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"description"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"The transaction id."</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"required"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token string" style="color: rgb(166, 226, 46);">"transaction_id"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"></span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<ul>
<li>Then we organize the two functions into a dictionary where keys represent the function name, and values are the function with the <code>df</code> defined. This allows us to call each function based on its function name.</li>
</ul>
<div class="language-python codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-python codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token keyword" style="color: rgb(102, 217, 239);">import</span><span class="token plain"> functools</span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain" style="display: inline-block;"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">names_to_functions </span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'retrieve_payment_status'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> functools</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">partial</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">retrieve_payment_status</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> df</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain">df</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">'retrieve_payment_date'</span><span class="token punctuation" style="color: rgb(248, 248, 242);">:</span><span class="token plain"> functools</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">partial</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">retrieve_payment_date</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> df</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain">df</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"></span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<h3 class="anchor anchorWithStickyNavbar_r6n_" id="user-query">User query<a href="https://docs.mistral.ai/capabilities/function_calling/#user-query" class="hash-link" aria-label="Direct link to User query" title="Direct link to User query"></a></h3>
<p>Suppose a user asks the following question: “What’s the status of my transaction?” A standalone LLM would not be able to answer this question, as it needs to query the business logic backend to access the necessary data. But what if we have an exact tool we can use to answer this question? We could potentially provide an answer!</p>
<div class="language-python codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-python codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token keyword" style="color: rgb(102, 217, 239);">from</span><span class="token plain"> mistralai</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">models</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">chat_completion </span><span class="token keyword" style="color: rgb(102, 217, 239);">import</span><span class="token plain"> ChatMessage</span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain" style="display: inline-block;"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">messages </span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"> ChatMessage</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">role</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token string" style="color: rgb(166, 226, 46);">"user"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> content</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token string" style="color: rgb(166, 226, 46);">"What's the status of my transaction T1001?"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"></span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<h2 class="anchor anchorWithStickyNavbar_r6n_" id="step-2-model-generate-function-arguments">Step 2. Model: Generate function arguments<a href="https://docs.mistral.ai/capabilities/function_calling/#step-2-model-generate-function-arguments" class="hash-link" aria-label="Direct link to Step 2. Model: Generate function arguments" title="Direct link to Step 2. Model: Generate function arguments"></a></h2>
<img src="./Function calling _ Mistral AI Large Language Models_files/functioncalling3.png" alt="drawing" width="600">
<p>How do Mistral models know about these functions and know which function to use? We provide both the user query and the tools specifications to Mistral models. The goal in this step is not for the Mistral model to run the function directly. It’s to 1) determine the appropriate function to use , 2) identify if there is any essential information missing for a function, and 3) generate necessary arguments for the chosen function.</p>
<h3 class="anchor anchorWithStickyNavbar_r6n_" id="tool_choice">tool_choice<a href="https://docs.mistral.ai/capabilities/function_calling/#tool_choice" class="hash-link" aria-label="Direct link to tool_choice" title="Direct link to tool_choice"></a></h3>
<p>Users can use <code>tool_choice</code> to speficy how tools are used:</p>
<ul>
<li>"auto": default mode. Model decides if it uses the tool or not.</li>
<li>"any": forces tool use.</li>
<li>"none": prevents tool use.</li>
</ul>
<div class="language-python codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-python codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token keyword" style="color: rgb(102, 217, 239);">from</span><span class="token plain"> mistralai</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">client </span><span class="token keyword" style="color: rgb(102, 217, 239);">import</span><span class="token plain"> MistralClient</span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"></span><span class="token keyword" style="color: rgb(102, 217, 239);">from</span><span class="token plain"> mistralai</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">models</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">chat_completion </span><span class="token keyword" style="color: rgb(102, 217, 239);">import</span><span class="token plain"> ChatMessage</span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain" style="display: inline-block;"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">model </span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"mistral-large-latest"</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">api_key</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token string" style="color: rgb(166, 226, 46);">"TYPE YOUR API KEY"</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain" style="display: inline-block;"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">client </span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain"> MistralClient</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">api_key</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain">api_key</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">response </span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain"> client</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">chat</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">model</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain">model</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> messages</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain">messages</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> tools</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain">tools</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> tool_choice</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token string" style="color: rgb(166, 226, 46);">"auto"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">response</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>We get the response including tool_calls with the chosen function name <code>retrieve_payment_status</code> and the arguments for this function.</p>
<p>Output:</p>
<div class="codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-text codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">ChatCompletionResponse(id='9ec8d47af52d4c258c641a7d9f62336e', object='chat.completion', created=1707931630, model='mistral-large', choices=[ChatCompletionResponseChoice(index=0, message=ChatMessage(role='assistant', content='', name=None, tool_calls=[ToolCall(id='null', type=<ToolType.function: 'function'>, function=FunctionCall(name='retrieve_payment_status', arguments='{"transaction_id": "T1001"}'))]), finish_reason=<FinishReason.stop: 'stop'>)], usage=UsageInfo(prompt_tokens=211, total_tokens=250, completion_tokens=39))</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>Let’s add the response message to the <code>messages</code> list.</p>
<div class="language-python codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-python codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">messages</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">append</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">response</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">choices</span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token number" style="color: rgb(174, 129, 255);">0</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">message</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<h2 class="anchor anchorWithStickyNavbar_r6n_" id="step-3-user-execute-function-to-obtain-tool-results">Step 3. User: Execute function to obtain tool results<a href="https://docs.mistral.ai/capabilities/function_calling/#step-3-user-execute-function-to-obtain-tool-results" class="hash-link" aria-label="Direct link to Step 3. User: Execute function to obtain tool results" title="Direct link to Step 3. User: Execute function to obtain tool results"></a></h2>
<img src="./Function calling _ Mistral AI Large Language Models_files/functioncalling4.png" alt="drawing" width="600">
<p>How do we execute the function? Currently, it is the user’s responsibility to execute these functions and the function execution lies on the user side. In the future, we may introduce some helpful functions that can be executed server-side.</p>
<p>Let’s extract some useful function information from model response including <code>function_name</code> and <code>function_params</code>. It’s clear here that our Mistral model has chosen to use the function <code>retrieve_payment_status</code> with the parameter <code>transaction_id</code> set to T1001.</p>
<div class="language-python codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-python codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token keyword" style="color: rgb(102, 217, 239);">import</span><span class="token plain"> json</span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain" style="display: inline-block;"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">tool_call </span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain"> response</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">choices</span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token number" style="color: rgb(174, 129, 255);">0</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">message</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">tool_calls</span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token number" style="color: rgb(174, 129, 255);">0</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">function_name </span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain"> tool_call</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">function</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">name</span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">function_params </span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain"> json</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">loads</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">tool_call</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">function</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">arguments</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain"></span><span class="token keyword" style="color: rgb(102, 217, 239);">print</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token string" style="color: rgb(166, 226, 46);">"\nfunction_name: "</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> function_name</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> </span><span class="token string" style="color: rgb(166, 226, 46);">"\nfunction_params: "</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> function_params</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>Output</p>
<div class="codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-text codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">function_name: retrieve_payment_status </span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">function_params: {'transaction_id': 'T1001'}</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>Now we can execute the function and we get the function output <code>'{"status": "Paid"}'</code>.</p>
<div class="language-python codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-python codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">function_result </span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain"> names_to_functions</span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token plain">function_name</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token operator" style="color: rgb(102, 217, 239);">**</span><span class="token plain">function_params</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">function_result</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>Output</p>
<div class="codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-text codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">'{"status": "Paid"}'</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<h2 class="anchor anchorWithStickyNavbar_r6n_" id="step-4-model-generate-final-answer">Step 4. Model: Generate final answer<a href="https://docs.mistral.ai/capabilities/function_calling/#step-4-model-generate-final-answer" class="hash-link" aria-label="Direct link to Step 4. Model: Generate final answer" title="Direct link to Step 4. Model: Generate final answer"></a></h2>
<img src="./Function calling _ Mistral AI Large Language Models_files/functioncalling5.png" alt="drawing" width="600">
<p>We can now provide the output from the tools to Mistral models, and in return, the Mistral model can produce a customised final response for the specific user.</p>
<div class="language-python codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-python codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">messages</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">append</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">ChatMessage</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">role</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token string" style="color: rgb(166, 226, 46);">"tool"</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> name</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain">function_name</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> content</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain">function_result</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> tool_call_id</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain">tool_call</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token builtin" style="color: rgb(230, 219, 116);">id</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain" style="display: inline-block;"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">response </span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain"> client</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">chat</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">model</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain">model</span><span class="token punctuation" style="color: rgb(248, 248, 242);">,</span><span class="token plain"> messages</span><span class="token operator" style="color: rgb(102, 217, 239);">=</span><span class="token plain">messages</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"></span><br></span><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">response</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">choices</span><span class="token punctuation" style="color: rgb(248, 248, 242);">[</span><span class="token number" style="color: rgb(174, 129, 255);">0</span><span class="token punctuation" style="color: rgb(248, 248, 242);">]</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">message</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">content</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>Output:</p>
<div class="codeBlockContainer_YMIx theme-code-block" style="--prism-color: #f8f8f2; --prism-background-color: #272822;"><div class="codeBlockContent_l9UM"><pre tabindex="0" class="prism-code language-text codeBlock_iAC8 thin-scrollbar" style="color: rgb(248, 248, 242); background-color: rgb(39, 40, 34);"><code class="codeBlockLines_jCwv"><span class="token-line" style="color: rgb(248, 248, 242);"><span class="token plain">The status of your transaction with ID T1001 is "Paid". Is there anything else I can assist you with?</span><br></span></code></pre><div class="buttonGroup_k3YM"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_Lgzn" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_SOZX"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_sALW"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages"><a class="pagination-nav__link pagination-nav__link--prev" href="https://docs.mistral.ai/capabilities/embeddings/"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Embeddings</div></a><a class="pagination-nav__link pagination-nav__link--next" href="https://docs.mistral.ai/capabilities/json_mode/"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">JSON mode</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_dRcY thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="https://docs.mistral.ai/capabilities/function_calling/#available-models" class="table-of-contents__link toc-highlight">Available models</a></li><li><a href="https://docs.mistral.ai/capabilities/function_calling/#four-steps" class="table-of-contents__link toc-highlight">Four steps</a></li><li><a href="https://docs.mistral.ai/capabilities/function_calling/#step-1-user-specify-tools-and-query" class="table-of-contents__link toc-highlight">Step 1. User: specify tools and query</a><ul><li><a href="https://docs.mistral.ai/capabilities/function_calling/#tools" class="table-of-contents__link toc-highlight">Tools</a></li><li><a href="https://docs.mistral.ai/capabilities/function_calling/#user-query" class="table-of-contents__link toc-highlight">User query</a></li></ul></li><li><a href="https://docs.mistral.ai/capabilities/function_calling/#step-2-model-generate-function-arguments" class="table-of-contents__link toc-highlight">Step 2. Model: Generate function arguments</a><ul><li><a href="https://docs.mistral.ai/capabilities/function_calling/#tool_choice" class="table-of-contents__link toc-highlight">tool_choice</a></li></ul></li><li><a href="https://docs.mistral.ai/capabilities/function_calling/#step-3-user-execute-function-to-obtain-tool-results" class="table-of-contents__link toc-highlight">Step 3. User: Execute function to obtain tool results</a></li><li><a href="https://docs.mistral.ai/capabilities/function_calling/#step-4-model-generate-final-answer" class="table-of-contents__link toc-highlight">Step 4. Model: Generate final answer</a></li></ul></div></div></div></div></main></div></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">Documentation</div><ul class="footer__items clean-list"><li class="footer__item"><a class="footer__link-item" href="https://docs.mistral.ai/">Documentation</a></li><li class="footer__item"><a class="footer__link-item" href="https://docs.mistral.ai/guides/contribute/">Contributing</a></li></ul></div><div class="col footer__col"><div class="footer__title">Community</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://discord.gg/mistralai" target="_blank" rel="noopener noreferrer" class="footer__link-item">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_yPTG"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://twitter.com/MistralAI" target="_blank" rel="noopener noreferrer" class="footer__link-item">X<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_yPTG"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://github.com/mistralai" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_yPTG"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="footer__bottom text--center"><div class="footer__copyright">Copyright © 2024 Mistral AI.</div></div></div></footer></div>
<!-- Cloudflare Pages Analytics --><script defer="" src="./Function calling _ Mistral AI Large Language Models_files/beacon.min.js.download" data-cf-beacon="{"token": "f43ca8e80d85407ea6ca57cd621eacc6"}"></script><!-- Cloudflare Pages Analytics --><script defer="" src="./Function calling _ Mistral AI Large Language Models_files/vef91dfe02fce4ee0ad053f6de4f175db1715022073587" integrity="sha512-sDIX0kl85v1Cl5tu4WGLZCpH/dV9OHbA4YlKCuCiMmOQIk4buzoYDZSFj+TvC71mOBLh8CDC/REgE0GX0xcbjA==" data-cf-beacon="{"rayId":"88972f6e398eab5d","version":"2024.4.1","token":"36b4216ae2dc4d5488c249161e71fe1e"}" crossorigin="anonymous"></script>
</body></html>