-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrag-from-external-data-provider.html
More file actions
277 lines (277 loc) · 265 KB
/
rag-from-external-data-provider.html
File metadata and controls
277 lines (277 loc) · 265 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<!DOCTYPE html><html lang="en" class="dark">
<!-- Mirrored from guide.gpt-trainer.com/rag-from-external-data-provider by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 07 Jan 2025 14:53:24 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../mintlify.s3-us-west-1.amazonaws.com/paladinmaxinc/_generated/favicon/apple-touch-icon30f4.png?v=3"/><link rel="icon" type="image/png" sizes="32x32" href="../mintlify.s3-us-west-1.amazonaws.com/paladinmaxinc/_generated/favicon/favicon-32x3230f4.png?v=3"/><link rel="icon" type="image/png" sizes="16x16" href="../mintlify.s3-us-west-1.amazonaws.com/paladinmaxinc/_generated/favicon/favicon-16x1630f4.png?v=3"/><link rel="shortcut icon" type="image/x-icon" href="https://mintlify.s3-us-west-1.amazonaws.com/paladinmaxinc/_generated/favicon/favicon.ico?v=3"/><meta name="msapplication-config" content="https://mintlify.s3-us-west-1.amazonaws.com/paladinmaxinc/_generated/favicon/browserconfig.xml?v=3"/><meta name="apple-mobile-web-app-title" content="GPT-trainer API"/><meta name="application-name" content="GPT-trainer API"/><meta name="msapplication-TileColor" content="#2E3F51"/><meta name="theme-color" content="#ffffff"/><link rel="sitemap" type="application/xml" href="sitemap.xml"/><meta name="charset" content="utf-8"/><meta name="og:type" content="website"/><meta name="og:site_name" content="GPT-trainer API"/><meta name="twitter:card" content="summary_large_image"/><meta name="og:title" content="RAG from an External Data Provider - GPT-trainer API"/><meta name="twitter:title" content="RAG from an External Data Provider - GPT-trainer API"/><meta name="og:image" content="https://mintlify.com/docs/api/og?division=Documentation&title=RAG+from+an+External+Data+Provider&logoLight=https%3A%2F%2Fmintlify.s3.us-west-1.amazonaws.com%2Fpaladinmaxinc%2Flogo%2Flight.svg&logoDark=https%3A%2F%2Fmintlify.s3.us-west-1.amazonaws.com%2Fpaladinmaxinc%2Flogo%2Fdark.svg&primaryColor=%232E3F51&lightColor=%23516F90&darkColor=%230D001D"/><meta name="twitter:image" content="https://mintlify.com/docs/api/og?division=Documentation&title=RAG+from+an+External+Data+Provider&logoLight=https%3A%2F%2Fmintlify.s3.us-west-1.amazonaws.com%2Fpaladinmaxinc%2Flogo%2Flight.svg&logoDark=https%3A%2F%2Fmintlify.s3.us-west-1.amazonaws.com%2Fpaladinmaxinc%2Flogo%2Fdark.svg&primaryColor=%232E3F51&lightColor=%23516F90&darkColor=%230D001D"/><title>RAG from an External Data Provider - GPT-trainer API</title><meta name="og:url" content="/rag-from-external-data-provider"/><link rel="canonical" href="rag-from-external-data-provider.html"/><meta name="next-head-count" content="23"/><link rel="stylesheet" href="../cdn.jsdelivr.net/npm/katex%400.16.0/dist/katex.min.css" integrity="sha384-Xi8rHCmBmhbuyyhbI88391ZKP2dmfnOl4rT9ZfRI7mLTdk1wblIUnrIq35nqwEvC" crossorigin="anonymous"/><link rel="preload" href="_next/static/media/a34f9d1faa5f3315-s.p.woff2" as="font" type="font/woff2" crossorigin="anonymous" data-next-font="size-adjust"/><link rel="preload" href="_next/static/media/bb3ef058b751a6ad-s.p.woff2" as="font" type="font/woff2" crossorigin="anonymous" data-next-font="size-adjust"/><script id="mode-toggle" data-nscript="beforeInteractive">
try {
if (localStorage.isDarkMode === 'true') {
document.documentElement.classList.add('dark');
} else if (localStorage.isDarkMode === 'false') {
document.documentElement.classList.remove('dark');
} else if ((true && !('isDarkMode' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches) || false) {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark');
}
} catch (_) {}
</script><link rel="preload" href="_next/static/css/16035c2adeba2fd7.css" as="style"/><link rel="stylesheet" href="_next/static/css/16035c2adeba2fd7.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="_next/static/chunks/webpack-99a660de06a74703.js" defer=""></script><script src="_next/static/chunks/framework-44a6e5dc2ffde502.js" defer=""></script><script src="_next/static/chunks/main-6f86f9a153903fae.js" defer=""></script><script src="_next/static/chunks/pages/_app-1767ed3009913161.js" defer=""></script><script src="_next/static/chunks/2edb282b-7fa355f49eaeb230.js" defer=""></script><script src="_next/static/chunks/e893f787-54a006ae51267903.js" defer=""></script><script src="_next/static/chunks/086d643d-3aa1cf46914548d9.js" defer=""></script><script src="_next/static/chunks/9097-75a5bfb192203d09.js" defer=""></script><script src="_next/static/chunks/7669-2cdcbf7436d2d1bd.js" defer=""></script><script src="_next/static/chunks/5339-37d37f3a0f878abf.js" defer=""></script><script src="_next/static/chunks/4922-ba19e45713cda605.js" defer=""></script><script src="_next/static/chunks/pages/_sites/%5bsubdomain%5d/%5b%5b...slug%5d%5d-7f2259a5793aeffc.js" defer=""></script><script src="_next/static/pChs_9tFT1YAEINLWWPhQ/_buildManifest.js" defer=""></script><script src="_next/static/pChs_9tFT1YAEINLWWPhQ/_ssgManifest.js" defer=""></script><style id="__jsx-4145347147">:root{--font-inter:'__Inter_e5ab12', '__Inter_Fallback_e5ab12';--font-jetbrains-mono:'__JetBrains_Mono_3c557b', '__JetBrains_Mono_Fallback_3c557b'}</style></head><div id="__next"><main class="jsx-4145347147"><style>:root {
--primary: 46 63 81;
--primary-light: 81 111 144;
--primary-dark: 13 0 29;
--background-light: 255 255 255;
--background-dark: 17 24 39;
--gray-50: 244 244 245;
--gray-100: 239 239 240;
--gray-200: 223 224 224;
--gray-300: 207 207 208;
--gray-400: 159 160 160;
--gray-500: 113 113 114;
--gray-600: 81 81 82;
--gray-700: 63 64 65;
--gray-800: 38 39 39;
--gray-900: 24 24 25;
--gray-950: 11 12 12;
}</style><div class="relative antialiased text-gray-500 dark:text-gray-400"><span class="fixed inset-0 bg-background-light dark:bg-background-dark -z-10"></span><div id="navbar" class="z-30 fixed lg:sticky top-0 w-full"><div id="navbar-transition" class="absolute w-full h-full backdrop-blur flex-none transition-colors duration-500 border-b border-gray-500/5 dark:border-gray-300/[0.06] supports-backdrop-blur:bg-background-light/60 dark:bg-transparent"></div><div class="max-w-8xl mx-auto relative"><div class=""><div class="relative"><div class="flex items-center lg:px-12 h-16 min-w-0 px-4"><div class="h-full relative flex-1 flex items-center gap-x-4 min-w-0 border-b border-gray-500/5 dark:border-gray-300/[0.06] lg:border-none"><div class="flex-1 flex items-center gap-x-4"><a href="index.html"><span class="sr-only">GPT-trainer API<!-- --> home page</span><img class="w-auto h-7 relative object-contain block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/logo/light.svg" alt="light logo"/><img class="w-auto h-7 relative object-contain hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/logo/dark.svg" alt="dark logo"/></a><div class="flex items-center gap-x-2"></div></div><div class="hidden lg:block mx-px relative flex-1 bg-white dark:bg-gray-900 pointer-events-auto rounded-xl min-w-0"><button type="button" class="w-full flex items-center text-sm leading-6 rounded-xl py-1.5 pl-3.5 pr-3 shadow-sm text-gray-400 dark:text-white/50 bg-background-light dark:bg-background-dark dark:brightness-[1.1] dark:ring-1 dark:hover:brightness-[1.25] ring-1 ring-gray-400/20 hover:ring-gray-600/25 dark:ring-gray-600/30 dark:hover:ring-gray-500/30 focus:outline-primary justify-between truncate gap-2 min-w-[43px]" id="search-bar-entry"><div class="flex items-center gap-3 min-w-[42px]"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-search min-w-4 flex-none text-gray-700 hover:text-gray-800 dark:text-gray-300 hover:dark:text-gray-200"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.3-4.3"></path></svg><div class="truncate min-w-0">Search...</div></div></button></div><div class="flex-1 relative hidden lg:flex items-center ml-auto justify-end space-x-4"><nav class="text-sm"><ul class="flex space-x-6 items-center"><li><a href="mailto:hello@gpt-trainer.com" class="whitespace-nowrap font-medium text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" target="_blank">Support</a></li></ul></nav><div class="flex items-center"><button class="group p-2 flex items-center justify-center" aria-label="Toggle dark mode"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 block text-gray-400 dark:hidden group-hover:text-gray-600"><g clip-path="url(#clip0_2880_7340)"><path d="M8 1.11133V2.00022" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M12.8711 3.12891L12.2427 3.75735" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M14.8889 8H14" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M12.8711 12.8711L12.2427 12.2427" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8 14.8889V14" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M3.12891 12.8711L3.75735 12.2427" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.11133 8H2.00022" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M3.12891 3.12891L3.75735 3.75735" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8.00043 11.7782C10.0868 11.7782 11.7782 10.0868 11.7782 8.00043C11.7782 5.91402 10.0868 4.22266 8.00043 4.22266C5.91402 4.22266 4.22266 5.91402 4.22266 8.00043C4.22266 10.0868 5.91402 11.7782 8.00043 11.7782Z" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_2880_7340"><rect width="16" height="16" fill="white"></rect></clipPath></defs></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-moon h-4 w-4 hidden dark:block text-gray-500 dark:group-hover:text-gray-300"><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"></path></svg></button></div></div><div class="flex lg:hidden items-center gap-2"><button type="button" class="text-gray-500 w-8 h-8 flex items-center justify-center hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-300" id="search-bar-entry-mobile"><span class="sr-only">Search...</span><svg class="h-4 w-4 bg-gray-500 dark:bg-gray-400 hover:bg-gray-600 dark:hover:bg-gray-300" style="-webkit-mask-image:url(https://mintlify.b-cdn.net/v6.6.0/solid/magnifying-glass.svg);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center"></svg></button><button aria-label="More actions" class="h-7 w-5 flex items-center justify-end"><svg class="h-4 w-4 bg-gray-500 dark:bg-gray-400 hover:bg-gray-600 dark:hover:bg-gray-300" style="-webkit-mask-image:url(https://mintlify.b-cdn.net/v6.6.0/solid/ellipsis-vertical.svg);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center"></svg></button></div></div></div><div class="flex items-center h-14 py-4 px-5 lg:hidden"><button type="button" class="text-gray-500 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-300"><span class="sr-only">Navigation</span><svg class="h-4" fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"></path></svg></button><div class="ml-4 flex text-sm leading-6 whitespace-nowrap min-w-0 space-x-3"><div class="flex items-center space-x-3"><span>Function Calling</span><svg width="3" height="24" viewBox="0 -9 3 24" class="h-5 rotate-0 overflow-visible fill-gray-400"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg></div><div class="font-semibold text-gray-900 truncate dark:text-gray-200">RAG from an External Data Provider</div></div></div></div></div></div></div><div class="max-w-8xl px-4 mx-auto lg:px-8 min-h-screen"><div class="z-20 hidden lg:block fixed bottom-0 right-auto w-[18rem] top-[4rem]" id="sidebar"><div class="absolute inset-0 z-10 stable-scrollbar-gutter overflow-auto pr-8 pb-10" id="sidebar-content"><div class="relative lg:text-sm lg:leading-6"><div class="sticky top-0 h-8 bg-gradient-to-b from-background-light dark:from-background-dark"></div><div id="navigation-items"><li class="list-none"><a class="pl-4 group flex items-center lg:text-sm lg:leading-6 mb-5 sm:mb-4 font-semibold text-primary dark:text-primary-light" href="introduction.html"><div style="background:linear-gradient(45deg, #ED727B, #F6B7BB)" class="mr-4 rounded-md p-1"><svg class="h-4 w-4 secondary-opacity group-hover:fill-primary-dark group-hover:bg-white bg-white" style="-webkit-mask-image:url(https://mintlify.b-cdn.net/v6.6.0/duotone/book-open.svg);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center"></svg></div>Documentation</a></li><li class="list-none"><a class="pl-4 group flex items-center lg:text-sm lg:leading-6 mb-5 sm:mb-4 font-medium text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" href="api-reference/api-key-setup.html"><div class="mr-4 rounded-md p-1 zinc-box group-hover:brightness-100 group-hover:ring-0 ring-1 ring-gray-950/5 dark:ring-gray-700/40"><svg class="h-4 w-4 secondary-opacity group-hover:fill-primary-dark group-hover:bg-white bg-gray-400 dark:bg-gray-500" style="-webkit-mask-image:url(https://mintlify.b-cdn.net/v6.6.0/duotone/code.svg);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center"></svg></div>API References</a></li><li class="list-none"><a class="pl-4 group flex items-center lg:text-sm lg:leading-6 mb-5 sm:mb-4 font-medium text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" href="tools/tools-intro.html"><div class="mr-4 rounded-md p-1 zinc-box group-hover:brightness-100 group-hover:ring-0 ring-1 ring-gray-950/5 dark:ring-gray-700/40"><svg class="h-4 w-4 secondary-opacity group-hover:fill-primary-dark group-hover:bg-white bg-gray-400 dark:bg-gray-500" style="-webkit-mask-image:url(https://mintlify.b-cdn.net/v6.6.0/duotone/gear.svg);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center"></svg></div>Tools</a></li><li class="list-none"><a class="pl-4 group flex items-center lg:text-sm lg:leading-6 mb-5 sm:mb-4 font-medium text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" href="whitelabel/whitelabel-intro.html"><div class="mr-4 rounded-md p-1 zinc-box group-hover:brightness-100 group-hover:ring-0 ring-1 ring-gray-950/5 dark:ring-gray-700/40"><svg class="h-4 w-4 secondary-opacity group-hover:fill-primary-dark group-hover:bg-white bg-gray-400 dark:bg-gray-500" style="-webkit-mask-image:url(https://mintlify.b-cdn.net/v6.6.0/duotone/browser.svg);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center"></svg></div>Whitelabel</a></li><div class="mt-12 lg:mt-8"><h5 class="pl-4 mb-3.5 lg:mb-2.5 font-semibold text-gray-900 dark:text-gray-200">Getting Started</h5><ul><li id="/introduction" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="introduction.html"><div class="flex-1 flex items-center space-x-2.5"><div>Introduction</div></div></a></li></ul></div><div class="mt-12 lg:mt-8"><h5 class="pl-4 mb-3.5 lg:mb-2.5 font-semibold text-gray-900 dark:text-gray-200">Guides</h5><ul><li id="/creating-first-chatbot" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="creating-first-chatbot.html"><div class="flex-1 flex items-center space-x-2.5"><div>Create Your First Chatbot</div></div></a></li><li id="/lead-collection" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="lead-collection.html"><div class="flex-1 flex items-center space-x-2.5"><div>Lead Collection</div></div></a></li><li id="/human-support-escalation" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="human-support-escalation.html"><div class="flex-1 flex items-center space-x-2.5"><div>Human Support Escalation</div></div></a></li><li id="/inbox-notifications" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="inbox-notifications.html"><div class="flex-1 flex items-center space-x-2.5"><div>Inbox Notifications</div></div></a></li><li id="/conversation-labeling" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="conversation-labeling.html"><div class="flex-1 flex items-center space-x-2.5"><div>Conversation Labeling</div></div></a></li><li id="/multi-agents-chatbot" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="multi-agents-chatbot.html"><div class="flex-1 flex items-center space-x-2.5"><div>Multi-Agents Chatbot</div></div></a></li><li id="/fine-tuning-agent-intents" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="fine-tuning-agent-intents.html"><div class="flex-1 flex items-center space-x-2.5"><div>Fine Tuning Agent Intents</div></div></a></li><li id="/supervisor-overrides" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="supervisor-overrides.html"><div class="flex-1 flex items-center space-x-2.5"><div>AI Supervisor Overrides</div></div></a></li><li id="/byok-pricing-guide" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="byok-pricing-guide.html"><div class="flex-1 flex items-center space-x-2.5"><div>Bring Your Own Key (BYOK) and Pricing</div></div></a></li><li id="/working-with-tables" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="working-with-tables.html"><div class="flex-1 flex items-center space-x-2.5"><div>Working with Tables and CSV</div></div></a></li><li id="/best-practices" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="best-practices.html"><div class="flex-1 flex items-center space-x-2.5"><div>Best practices for preparing training data</div></div></a></li><li id="/help" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="help.html"><div class="flex-1 flex items-center space-x-2.5"><div>Why does my chatbot not answer correctly?</div></div></a></li></ul></div><div class="mt-12 lg:mt-8"><h5 class="pl-4 mb-3.5 lg:mb-2.5 font-semibold text-gray-900 dark:text-gray-200">Function Calling</h5><ul><li id="/rag-from-external-data-provider" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl bg-primary/10 text-primary font-semibold dark:text-primary-light dark:bg-primary-light/10" style="padding-left:1rem" href="rag-from-external-data-provider.html"><div class="flex-1 flex items-center space-x-2.5"><div>RAG from an External Data Provider</div></div></a></li></ul></div><div class="mt-12 lg:mt-8"><h5 class="pl-4 mb-3.5 lg:mb-2.5 font-semibold text-gray-900 dark:text-gray-200">Authentication Webhook</h5><ul><li id="/user-identity" class="scroll-m-4 first:scroll-m-20"><a class="group mt-2 lg:mt-0 flex items-center pr-3 py-1.5 cursor-pointer focus:outline-primary dark:focus:outline-primary-light space-x-3 rounded-xl hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="user-identity.html"><div class="flex-1 flex items-center space-x-2.5"><div>User Identity Verification</div></div></a></li></ul></div></div></div></div></div><div class="" id="content-container"><div class="flex flex-row gap-12 box-border w-full pt-40 lg:pt-10"><div class="relative grow box-border flex-col w-full mx-auto px-1 lg:pl-[23.7rem] lg:-ml-12 xl:w-[calc(100%-28rem)]" id="content-area"><header id="header" class="relative"><div class="mt-0.5 space-y-2.5"><div class="eyebrow h-5 text-primary dark:text-primary-light text-sm font-semibold">Function Calling</div><div class="flex items-center"><h1 class="inline-block text-2xl sm:text-3xl font-extrabold text-gray-900 tracking-tight dark:text-gray-200">RAG from an External Data Provider</h1></div></div></header><div class="flex flex-col gap-8"><div class="flex flex-col gap-6 xl:hidden [&:not(:empty)]:mt-8"></div></div><div class="relative mt-8 prose prose-gray dark:prose-invert"><p>Uploading static sources as training data for your AI Agents is well and good, but what if your database is huge, structured, externally-hosted,
or updated in real-time? There is no way to dump the entire database into GPT-trainer’s static knowledge library and still maintain a live link…</p>
<p>This is where function-calling comes in. Through function-calling, you can serve data on-demand to your AI Agent in GPT-trainer during a live
conversation session. To show you how, we walk you through an example of RAG enrichment using (abstracts of) academic papers sourced from a trusted
academic papers aggregator: Semantic Scholar API.</p>
<h2 class="flex whitespace-pre-wrap group" id="setting-up-and-testing-the-function"><div class="absolute"><a href="#setting-up-and-testing-the-function" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100" aria-label="Navigate to header"><div class="w-6 h-6 text-gray-400 rounded-md flex items-center justify-center zinc-box bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20"><svg xmlns="http://www.w3.org/2000/svg" fill="gray" height="12px" viewBox="0 0 576 512"><path d="M0 256C0 167.6 71.6 96 160 96h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C98.1 144 48 194.1 48 256s50.1 112 112 112h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C71.6 416 0 344.4 0 256zm576 0c0 88.4-71.6 160-160 160H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c61.9 0 112-50.1 112-112s-50.1-112-112-112H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c88.4 0 160 71.6 160 160zM184 232H392c13.3 0 24 10.7 24 24s-10.7 24-24 24H184c-13.3 0-24-10.7-24-24s10.7-24 24-24z"></path></svg></div></a></div><span class="cursor-pointer">Setting up and testing the function</span></h2>
<p>First, you’ll need an API key from your external data provider, whoever that may be, assuming they have a secure API. In our case, we requested one
from <a href="https://www.semanticscholar.org/" target="_blank" rel="noreferrer">Semantic Scholar</a> directly.</p>
<p>Since we want to enrich our LLM query response with relevant information from academic research, we need to find the appropriate API endpoint to
conduct the search. Semantic Scholar offers nice <a href="https://api.semanticscholar.org/api-docs/graph#tag/Paper-Data/operation/get_graph_paper_relevance_search" target="_blank" rel="noreferrer">documentation</a>
in that regard.</p>
<div><div class="p-2 not-prose relative bg-gray-50/50 rounded-2xl overflow-hidden dark:bg-gray-800/25"><div style="background-position:10px 10px" class="absolute inset-0 bg-grid-neutral-200/20 [mask-image:linear-gradient(0deg,#fff,rgba(255,255,255,0.6))] dark:bg-grid-white/5 dark:[mask-image:linear-gradient(0deg,rgba(255,255,255,0.1),rgba(255,255,255,0.5))]"></div><div class="relative rounded-xl overflow-hidden flex justify-center"></div><div class="absolute inset-0 pointer-events-none border border-black/5 rounded-2xl dark:border-white/5"></div></div></div>
<p>So what does this API endpoint respond with?</p>
<p>To inspect the output, we ran a script that makes a request to the API based on hardcoded input parameters. The source code of our script is included
below. You will need your own Semantic Scholar API key if you wish to run it yourself. For our example, we ran a search for relevant papers on the topic
of “Multifidelity Optimization” and “Gaussian Processes”.</p>
<div class="mt-5 mb-8 not-prose rounded-2xl relative text-gray-50 bg-[#0F1117] dark:bg-codeblock dark:ring-1 dark:ring-gray-800/50 codeblock-dark"><div class="min-w-full relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out" style="font-variant-ligatures:none;height:auto"><div class="overflow-x-auto h-full p-5 overflow-y-hidden scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-white/20 dark:scrollbar-thumb-white/20 hover:scrollbar-thumb-white/25 dark:hover:scrollbar-thumb-white/25 active:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25"><pre class="language-python"><code class="language-python"><span class=""><span class="token keyword">import</span> requests</span>
<span class=""><span class="token keyword">import</span> json</span>
<span class=""><span class="token keyword">import</span> os</span>
<!-- -->
<span class=""><span class="token comment"># Set up the headers with the API key</span></span>
<span class="">headers <span class="token operator">=</span> <span class="token punctuation">{</span></span>
<span class=""> <span class="token string">'X-API-KEY'</span><span class="token punctuation">:</span> <span class="token string">"YOUR OWN API KEY"</span></span>
<span class=""><span class="token punctuation">}</span></span>
<!-- -->
<span class=""><span class="token comment"># Specify the fields you want to fetch for each recommended paper</span></span>
<span class="">fields <span class="token operator">=</span> <span class="token string">"paperId,title,authors,abstract,url,referenceCount"</span></span>
<!-- -->
<span class=""><span class="token comment"># Define the limit for the number of recommendations to return</span></span>
<span class="">limit <span class="token operator">=</span> <span class="token number">20</span></span>
<!-- -->
<span class=""><span class="token comment"># Make the request to get paper recommendations</span></span>
<span class="">response <span class="token operator">=</span> requests<span class="token punctuation">.</span>get<span class="token punctuation">(</span></span>
<span class=""> <span class="token string">'https://api.semanticscholar.org/graph/v1/paper/search'</span><span class="token punctuation">,</span></span>
<span class=""> headers<span class="token operator">=</span>headers<span class="token punctuation">,</span></span>
<span class=""> <span class="token comment"># json=payload,</span></span>
<span class=""> params<span class="token operator">=</span><span class="token punctuation">{</span><span class="token string">'fields'</span><span class="token punctuation">:</span> fields<span class="token punctuation">,</span> <span class="token string">'limit'</span><span class="token punctuation">:</span> limit<span class="token punctuation">,</span> <span class="token string">'query'</span><span class="token punctuation">:</span><span class="token string">'multifidelity optimization, gaussian processes'</span> <span class="token punctuation">}</span></span>
<span class=""><span class="token punctuation">)</span></span>
<!-- -->
<span class=""><span class="token comment"># Check if the request was successful</span></span>
<span class=""><span class="token keyword">if</span> response<span class="token punctuation">.</span>status_code <span class="token operator">==</span> <span class="token number">200</span><span class="token punctuation">:</span></span>
<span class=""> <span class="token keyword">print</span><span class="token punctuation">(</span>json<span class="token punctuation">.</span>dumps<span class="token punctuation">(</span>response<span class="token punctuation">.</span>json<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> indent<span class="token operator">=</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">)</span></span>
<span class=""><span class="token keyword">else</span><span class="token punctuation">:</span></span>
<span class=""> <span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f"Error: </span><span class="token interpolation"><span class="token punctuation">{</span>response<span class="token punctuation">.</span>status_code<span class="token punctuation">}</span></span><span class="token string">"</span></span><span class="token punctuation">)</span></span>
<span class=""> <span class="token comment"># It's better to print response.text for non-200 responses, as they may not be in JSON format</span></span>
<span class=""> <span class="token keyword">print</span><span class="token punctuation">(</span>response<span class="token punctuation">.</span>text<span class="token punctuation">)</span></span>
</code></pre></div></div></div>
<p>The output we received looks like follows:</p>
<div class="mt-5 mb-8 not-prose rounded-2xl relative text-gray-50 bg-[#0F1117] dark:bg-codeblock dark:ring-1 dark:ring-gray-800/50 codeblock-dark"><div class="min-w-full relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out" style="font-variant-ligatures:none;height:auto"><div class="overflow-x-auto h-full p-5 overflow-y-hidden scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-white/20 dark:scrollbar-thumb-white/20 hover:scrollbar-thumb-white/25 dark:hover:scrollbar-thumb-white/25 active:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25"><pre class="language-json"><code class="language-json"><span class=""><span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"total"</span><span class="token operator">:</span> <span class="token number">12096</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"offset"</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"next"</span><span class="token operator">:</span> <span class="token number">20</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"data"</span><span class="token operator">:</span> <span class="token punctuation">[</span></span>
<span class=""> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"paperId"</span><span class="token operator">:</span> <span class="token string">"b108e6e11f4a96d5058945f3b582a032e8204ade"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"url"</span><span class="token operator">:</span> <span class="token string">"https://www.semanticscholar.org/paper/b108e6e11f4a96d5058945f3b582a032e8204ade"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"title"</span><span class="token operator">:</span> <span class="token string">"Multifidelity Gaussian processes for failure boundary andprobability estimation"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"abstract"</span><span class="token operator">:</span> <span class="token string">"Estimating probability of failure in aerospace systems is a critical requirement for flight certification and qualification. Failure probability estimation (FPE) involves resolving tails of probability distribution and Monte Carlo (MC) sampling methods are intractable when expensive high-fidelity simulations have to be queried. We propose a method to use models of multiple fidelities, which trade accuracy for computational efficiency. Specifically, we propose the use of multifidelity Gaussian process models to efficiently fuse models at multiple fidelity. Furthermore, we propose a novel acquisition function within a Bayesian optimization framework, which can sequentially select samples (or batches of samples for parallel evaluation) from appropriate fidelity models to make predictions about quantities of interest in the highest fidelity. We use our proposed approach within a multifidelity importance sampling (MFIS) setting, and demonstrate our method on the failure level set estimation on synthetic test functions as well as the transonic flow past an airfoil wing section."</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"referenceCount"</span><span class="token operator">:</span> <span class="token number">49</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"authors"</span><span class="token operator">:</span> <span class="token punctuation">[</span></span>
<span class=""> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"authorId"</span><span class="token operator">:</span> <span class="token string">"98543101"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"name"</span><span class="token operator">:</span> <span class="token string">"Ashwin Renganathan"</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"authorId"</span><span class="token operator">:</span> <span class="token string">"144321616"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"name"</span><span class="token operator">:</span> <span class="token string">"Vishwas Rao"</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"authorId"</span><span class="token operator">:</span> <span class="token string">"143672238"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"name"</span><span class="token operator">:</span> <span class="token string">"Ionel M. Navon"</span></span>
<span class=""> <span class="token punctuation">}</span></span>
<span class=""> <span class="token punctuation">]</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"paperId"</span><span class="token operator">:</span> <span class="token string">"963a5c60ada159d27641a284008f57d6419b26f2"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"url"</span><span class="token operator">:</span> <span class="token string">"https://www.semanticscholar.org/paper/963a5c60ada159d27641a284008f57d6419b26f2"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"title"</span><span class="token operator">:</span> <span class="token string">"Generative Transfer Optimization for Aerodynamic Design"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"abstract"</span><span class="token operator">:</span> <span class="token string">"Transfer optimization, one type of optimization methods, which leverages knowledge of the completed tasks to accelerate the design progress of a new task, has been in widespread use in machine learning community. However, when applying transfer optimization to accelerate the progress of aerodynamic shape optimization (ASO), two challenges are encountered in sequence, that is, (1) how to build a shared design space among the related aerodynamic design tasks, and (2) how to exchange information between tasks most efficiently. To address the first challenge, a datadriven generative model is used to learn airfoil representations from the existing database, with the aim of synthesizing various airfoil shapes in a shared design space. To address the second challenge, both singleand multifidelity Gaussian processes (GPs) are employed to carry out optimization. On one hand, the multifidelity GP is used to leverage knowledge from the completed tasks. On the other hand, mutual learning is established between singleand multifidelity GP models by exchanging information between them in each optimization cycle. With the above, a generative transfer optimization (GTO) framework is proposed to shorten the design cycle of aerodynamic design. Through airfoil optimizations at different working conditions, the effectiveness of the proposed GTO framework is demonstrated."</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"referenceCount"</span><span class="token operator">:</span> <span class="token number">16</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"authors"</span><span class="token operator">:</span> <span class="token punctuation">[</span></span>
<span class=""> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"authorId"</span><span class="token operator">:</span> <span class="token string">"2149505113"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"name"</span><span class="token operator">:</span> <span class="token string">"Zhendong Guo"</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"authorId"</span><span class="token operator">:</span> <span class="token string">"2153199285"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"name"</span><span class="token operator">:</span> <span class="token string">"Wei Sun"</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"authorId"</span><span class="token operator">:</span> <span class="token string">"50258957"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"name"</span><span class="token operator">:</span> <span class="token string">"Liming Song"</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"authorId"</span><span class="token operator">:</span> <span class="token string">"46276037"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"name"</span><span class="token operator">:</span> <span class="token string">"Jun Yu Li"</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"authorId"</span><span class="token operator">:</span> <span class="token string">"73325644"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"name"</span><span class="token operator">:</span> <span class="token string">"Z. Feng"</span></span>
<span class=""> <span class="token punctuation">}</span></span>
<span class=""> <span class="token punctuation">]</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class="">… (truncated due to length)</span>
</code></pre></div></div></div>
<p>The Semantic Scholar function returned the top 20 matching results ranked by relevance based on our input parameter specification. As you see, the response
can get quite long, so we truncated the output for conciseness.</p>
<p>Ideally, you want a structured JSON response from the function’s output like what we showed above.</p>
<p>We ran our own analysis for this particular API endpoint (with the specific set of output fields we requested) and found that on average, each returned
result is between 400-500 tokens long. This means that depending on the token limit we reserved for the function output, we can only fit so many search results
in before running out of space. Keep this in mind as you prioritize the information you wish to supply to the LLM during RAG.</p>
<p>Now we know what the LLM would see as additional context provided by the function call, we can start linking it to our GPT-trainer Agent.</p>
<div class="my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border border-sky-500/20 bg-sky-50/50 dark:border-sky-500/30 dark:bg-sky-500/10"><div class="mt-0.5 w-4"><svg width="14" height="14" viewBox="0 0 14 14" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 text-sky-500" aria-label="Note"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 1.3C10.14 1.3 12.7 3.86 12.7 7C12.7 10.14 10.14 12.7 7 12.7C5.48908 12.6974 4.0408 12.096 2.97241 11.0276C1.90403 9.9592 1.30264 8.51092 1.3 7C1.3 3.86 3.86 1.3 7 1.3ZM7 0C3.14 0 0 3.14 0 7C0 10.86 3.14 14 7 14C10.86 14 14 10.86 14 7C14 3.14 10.86 0 7 0ZM8 3H6V8H8V3ZM8 9H6V11H8V9Z"></path></svg></div><div class="text-sm prose min-w-0 text-sky-900 dark:text-sky-200"><p>It is ALWAYS advisable to write your own script and test for the output of the API endpoint first. You want to know exactly what kind information
is being fed into your AI Agent.</p></div></div>
<h2 class="flex whitespace-pre-wrap group" id="create-and-prepare-the-ai-agent"><div class="absolute"><a href="#create-and-prepare-the-ai-agent" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100" aria-label="Navigate to header"><div class="w-6 h-6 text-gray-400 rounded-md flex items-center justify-center zinc-box bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20"><svg xmlns="http://www.w3.org/2000/svg" fill="gray" height="12px" viewBox="0 0 576 512"><path d="M0 256C0 167.6 71.6 96 160 96h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C98.1 144 48 194.1 48 256s50.1 112 112 112h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C71.6 416 0 344.4 0 256zm576 0c0 88.4-71.6 160-160 160H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c61.9 0 112-50.1 112-112s-50.1-112-112-112H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c88.4 0 160 71.6 160 160zM184 232H392c13.3 0 24 10.7 24 24s-10.7 24-24 24H184c-13.3 0-24-10.7-24-24s10.7-24 24-24z"></path></svg></div></a></div><span class="cursor-pointer">Create and prepare the AI Agent</span></h2>
<p>In your chatbot inside GPT-trainer, you must first create an appropriate AI Agent that you plan to give this function-calling capability to. In our example,
we created “The Professor”. We then defined an associated Agent description and base prompt.</p>
<div><div class="p-2 not-prose relative bg-gray-50/50 rounded-2xl overflow-hidden dark:bg-gray-800/25"><div style="background-position:10px 10px" class="absolute inset-0 bg-grid-neutral-200/20 [mask-image:linear-gradient(0deg,#fff,rgba(255,255,255,0.6))] dark:bg-grid-white/5 dark:[mask-image:linear-gradient(0deg,rgba(255,255,255,0.1),rgba(255,255,255,0.5))]"></div><div class="relative rounded-xl overflow-hidden flex justify-center"></div><div class="absolute inset-0 pointer-events-none border border-black/5 rounded-2xl dark:border-white/5"></div></div></div>
<p>We picked the GPT-4-0125-8k Model for this example. You can see our simple prompt in the screenshot below.</p>
<div><div class="p-2 not-prose relative bg-gray-50/50 rounded-2xl overflow-hidden dark:bg-gray-800/25"><div style="background-position:10px 10px" class="absolute inset-0 bg-grid-neutral-200/20 [mask-image:linear-gradient(0deg,#fff,rgba(255,255,255,0.6))] dark:bg-grid-white/5 dark:[mask-image:linear-gradient(0deg,rgba(255,255,255,0.1),rgba(255,255,255,0.5))]"></div><div class="relative rounded-xl overflow-hidden flex justify-center"></div><div class="absolute inset-0 pointer-events-none border border-black/5 rounded-2xl dark:border-white/5"></div></div></div>
<p>Next, we save the Agent and go to the “Knowledge” tab to disable static RAG from the chatbot’s own knowledge library. This is only necessary if you don’t want
to use any training data from the static sources list. In our example, we didn’t upload any training data anyways, but we do this as standard practice to keep
things clean.</p>
<div><div class="p-2 not-prose relative bg-gray-50/50 rounded-2xl overflow-hidden dark:bg-gray-800/25"><div style="background-position:10px 10px" class="absolute inset-0 bg-grid-neutral-200/20 [mask-image:linear-gradient(0deg,#fff,rgba(255,255,255,0.6))] dark:bg-grid-white/5 dark:[mask-image:linear-gradient(0deg,rgba(255,255,255,0.1),rgba(255,255,255,0.5))]"></div><div class="relative rounded-xl overflow-hidden flex justify-center"></div><div class="absolute inset-0 pointer-events-none border border-black/5 rounded-2xl dark:border-white/5"></div></div></div>
<p>Save the Agent.</p>
<h2 class="flex whitespace-pre-wrap group" id="function-setup"><div class="absolute"><a href="#function-setup" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100" aria-label="Navigate to header"><div class="w-6 h-6 text-gray-400 rounded-md flex items-center justify-center zinc-box bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20"><svg xmlns="http://www.w3.org/2000/svg" fill="gray" height="12px" viewBox="0 0 576 512"><path d="M0 256C0 167.6 71.6 96 160 96h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C98.1 144 48 194.1 48 256s50.1 112 112 112h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C71.6 416 0 344.4 0 256zm576 0c0 88.4-71.6 160-160 160H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c61.9 0 112-50.1 112-112s-50.1-112-112-112H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c88.4 0 160 71.6 160 160zM184 232H392c13.3 0 24 10.7 24 24s-10.7 24-24 24H184c-13.3 0-24-10.7-24-24s10.7-24 24-24z"></path></svg></div></a></div><span class="cursor-pointer">Function setup</span></h2>
<p>Within your Agent, head over to the “Functions” tab. Change the “Response Context Limit” to the maximum allowed. Then click “Add function”.</p>
<div><div class="p-2 not-prose relative bg-gray-50/50 rounded-2xl overflow-hidden dark:bg-gray-800/25"><div style="background-position:10px 10px" class="absolute inset-0 bg-grid-neutral-200/20 [mask-image:linear-gradient(0deg,#fff,rgba(255,255,255,0.6))] dark:bg-grid-white/5 dark:[mask-image:linear-gradient(0deg,rgba(255,255,255,0.1),rgba(255,255,255,0.5))]"></div><div class="relative rounded-xl overflow-hidden flex justify-center"></div><div class="absolute inset-0 pointer-events-none border border-black/5 rounded-2xl dark:border-white/5"></div></div></div>
<p>This is where you tell the LLM exactly what the function does and how it works. The LLM will then decide on its own whether it needs the function when responding
to the user during a conversation, then call it with the appropriate parameters as needed.</p>
<div><div class="p-2 not-prose relative bg-gray-50/50 rounded-2xl overflow-hidden dark:bg-gray-800/25"><div style="background-position:10px 10px" class="absolute inset-0 bg-grid-neutral-200/20 [mask-image:linear-gradient(0deg,#fff,rgba(255,255,255,0.6))] dark:bg-grid-white/5 dark:[mask-image:linear-gradient(0deg,rgba(255,255,255,0.1),rgba(255,255,255,0.5))]"></div><div class="relative rounded-xl overflow-hidden flex justify-center"></div><div class="absolute inset-0 pointer-events-none border border-black/5 rounded-2xl dark:border-white/5"></div></div></div>
<p>The function name and description are particularly useful in helping the AI understand what the function does. Please make sure to be as explicit as possible in
your own definition. The function description must be less than 1024 characters, including spaces. In our case, we wrote the following:</p>
<div class="mt-5 mb-8 not-prose rounded-2xl relative text-gray-50 bg-[#0F1117] dark:bg-codeblock dark:ring-1 dark:ring-gray-800/50 codeblock-dark"><div class="min-w-full relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out" style="font-variant-ligatures:none;height:auto"><div class="overflow-x-auto h-full p-5 overflow-y-hidden scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-white/20 dark:scrollbar-thumb-white/20 hover:scrollbar-thumb-white/25 dark:hover:scrollbar-thumb-white/25 active:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25"><pre class="language-plaintext"><code><span class="">Function name: paper_relevance_search</span>
<!-- -->
<span class="">Function description: </span>
<span class="">This function searches Semantic Scholar, a scholarly literature database. The input parameters will be defined based on extracted information from conversation context. It will return search results containing academic paper metadata (with abstracts) in a JSON format.</span>
<span class="">The returned fields are defined as follows:</span>
<span class="">- title: paper title</span>
<span class="">- abstract: paper abstract</span>
<span class="">- paperId: paper uuid</span>
<span class="">- authors: paper authors</span>
<span class="">- year: paper publication year</span>
<span class="">- url: paper link</span>
<span class="">- referenceCount: number of references included in the paper</span>
<span class="">- citationCount: number of citations of this paper</span>
</code></pre></div></div></div>
<p>Next, define the API endpoint. The Semantic Scholar endpoint we are using is simple and straighforward:</p>
<div class="mt-5 mb-8 not-prose rounded-2xl relative text-gray-50 bg-[#0F1117] dark:bg-codeblock dark:ring-1 dark:ring-gray-800/50 codeblock-dark"><div class="min-w-full relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out" style="font-variant-ligatures:none;height:auto"><div class="overflow-x-auto h-full p-5 overflow-y-hidden scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-white/20 dark:scrollbar-thumb-white/20 hover:scrollbar-thumb-white/25 dark:hover:scrollbar-thumb-white/25 active:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25"><pre class="language-plaintext"><code><span class="">https://api.semanticscholar.org/graph/v1/paper/search</span>
</code></pre></div></div></div>
<p>After that, choose the HTTP method. We use “GET” for our example. The specific API endpoint you are using should have documentation about this distinction.</p>
<h2 class="flex whitespace-pre-wrap group" id="fixed-parameters"><div class="absolute"><a href="#fixed-parameters" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100" aria-label="Navigate to header"><div class="w-6 h-6 text-gray-400 rounded-md flex items-center justify-center zinc-box bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20"><svg xmlns="http://www.w3.org/2000/svg" fill="gray" height="12px" viewBox="0 0 576 512"><path d="M0 256C0 167.6 71.6 96 160 96h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C98.1 144 48 194.1 48 256s50.1 112 112 112h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C71.6 416 0 344.4 0 256zm576 0c0 88.4-71.6 160-160 160H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c61.9 0 112-50.1 112-112s-50.1-112-112-112H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c88.4 0 160 71.6 160 160zM184 232H392c13.3 0 24 10.7 24 24s-10.7 24-24 24H184c-13.3 0-24-10.7-24-24s10.7-24 24-24z"></path></svg></div></a></div><span class="cursor-pointer">Fixed parameters</span></h2>
<p>Static (Fixed) Parameters remain constant across all API requests. They are pre-defined and reflect settings or configurations that do not change with each
call. For example, parameters that specify the format of the response or that enable/disable certain features globally across all API interactions fall into
this category. The term “static” emphasizes their unchanging nature.</p>
<p>Depending on your particular API endpoint, you may need to append some fixed parameters in the URL. The API we use above from Semantic Scholar does not require
fixed parameters. But if you are using a more complex endpoint like this:
<a href="https://app.outscraper.com/api-docs#tag/Businesses-and-POI/paths/~1maps~1search-v3/get" target="_blank" rel="noreferrer">https://app.outscraper.com/api-docs#tag/Businesses-and-POI/paths/~1maps~1search-v3/get</a>, then your API endpoint may include fixed parameters and look something like:</p>
<div class="mt-5 mb-8 not-prose rounded-2xl relative text-gray-50 bg-[#0F1117] dark:bg-codeblock dark:ring-1 dark:ring-gray-800/50 codeblock-dark"><div class="min-w-full relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out" style="font-variant-ligatures:none;height:auto"><div class="overflow-x-auto h-full p-5 overflow-y-hidden scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-white/20 dark:scrollbar-thumb-white/20 hover:scrollbar-thumb-white/25 dark:hover:scrollbar-thumb-white/25 active:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25"><pre class="language-plaintext"><code><span class="">https://api.app.outscraper.com/maps/search-v3?async=false&fields=name,full_address,phone,site</span>
</code></pre></div></div></div>
<p>Notice that at the end of “<a href="https://api.app.outscraper.com/maps/search-v3" target="_blank" rel="noreferrer">https://api.app.outscraper.com/maps/search-v3</a>”, we get into fixed parameters. This is where you define parameters that will not change
when the function is called. Always define fixed parameters this way!</p>
<div class="my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border border-sky-500/20 bg-sky-50/50 dark:border-sky-500/30 dark:bg-sky-500/10"><div class="mt-0.5 w-4"><svg width="14" height="14" viewBox="0 0 14 14" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 text-sky-500" aria-label="Note"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 1.3C10.14 1.3 12.7 3.86 12.7 7C12.7 10.14 10.14 12.7 7 12.7C5.48908 12.6974 4.0408 12.096 2.97241 11.0276C1.90403 9.9592 1.30264 8.51092 1.3 7C1.3 3.86 3.86 1.3 7 1.3ZM7 0C3.14 0 0 3.14 0 7C0 10.86 3.14 14 7 14C10.86 14 14 10.86 14 7C14 3.14 10.86 0 7 0ZM8 3H6V8H8V3ZM8 9H6V11H8V9Z"></path></svg></div><div class="text-sm prose min-w-0 text-sky-900 dark:text-sky-200"><p>If your API is capable of returning a more concise response by configuring certain parameters (i.e., tell the API to leave out unnecessary metadata in the response),
then we highly suggest that you do so. It will reduce token waste and help AI understand the context better. In the above example, we set “fields=name,full_address,phone,site”
specifically to limit the response so that it contains only name, full_address, phone, and site information - and nothing else.</p></div></div>
<h2 class="flex whitespace-pre-wrap group" id="headers-and-authentication"><div class="absolute"><a href="#headers-and-authentication" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100" aria-label="Navigate to header"><div class="w-6 h-6 text-gray-400 rounded-md flex items-center justify-center zinc-box bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20"><svg xmlns="http://www.w3.org/2000/svg" fill="gray" height="12px" viewBox="0 0 576 512"><path d="M0 256C0 167.6 71.6 96 160 96h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C98.1 144 48 194.1 48 256s50.1 112 112 112h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C71.6 416 0 344.4 0 256zm576 0c0 88.4-71.6 160-160 160H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c61.9 0 112-50.1 112-112s-50.1-112-112-112H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c88.4 0 160 71.6 160 160zM184 232H392c13.3 0 24 10.7 24 24s-10.7 24-24 24H184c-13.3 0-24-10.7-24-24s10.7-24 24-24z"></path></svg></div></a></div><span class="cursor-pointer">Headers and Authentication</span></h2>
<p>In general, secure public-facing APIs require authentication. Semantic Scholar is the same. In the Header, we provide our API key. The specific key field used
to supply your authentication token will differ based on the particular API you use, so please make sure to be informed on your API provider’s documentation.
For our example, the key field is named “x-api-key”:</p>
<div><div class="p-2 not-prose relative bg-gray-50/50 rounded-2xl overflow-hidden dark:bg-gray-800/25"><div style="background-position:10px 10px" class="absolute inset-0 bg-grid-neutral-200/20 [mask-image:linear-gradient(0deg,#fff,rgba(255,255,255,0.6))] dark:bg-grid-white/5 dark:[mask-image:linear-gradient(0deg,rgba(255,255,255,0.1),rgba(255,255,255,0.5))]"></div><div class="relative rounded-xl overflow-hidden flex justify-center"></div><div class="absolute inset-0 pointer-events-none border border-black/5 rounded-2xl dark:border-white/5"></div></div></div>
<h2 class="flex whitespace-pre-wrap group" id="variable-parameters"><div class="absolute"><a href="#variable-parameters" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100" aria-label="Navigate to header"><div class="w-6 h-6 text-gray-400 rounded-md flex items-center justify-center zinc-box bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20"><svg xmlns="http://www.w3.org/2000/svg" fill="gray" height="12px" viewBox="0 0 576 512"><path d="M0 256C0 167.6 71.6 96 160 96h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C98.1 144 48 194.1 48 256s50.1 112 112 112h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C71.6 416 0 344.4 0 256zm576 0c0 88.4-71.6 160-160 160H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c61.9 0 112-50.1 112-112s-50.1-112-112-112H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c88.4 0 160 71.6 160 160zM184 232H392c13.3 0 24 10.7 24 24s-10.7 24-24 24H184c-13.3 0-24-10.7-24-24s10.7-24 24-24z"></path></svg></div></a></div><span class="cursor-pointer">Variable parameters</span></h2>
<p>Finally, we get to variable parameters.</p>
<p>Variable (Dynamic) Parameters dynamically change based on user input or conversation context, unlike their static counterparts. In function calling, these parameters
adapt to the specifics of each request, being determined at runtime. This ensures that API calls made by the AI are tailored to the immediate needs of the conversation,
enabling a more personalized and relevant interaction. The AI extracts these parameters directly from the dialogue, determining when and how to call the function
based on the ongoing conversation.</p>
<p>For our function, we define the following variable parameters:</p>
<div class="mt-5 mb-8 not-prose rounded-2xl relative text-gray-50 bg-[#0F1117] dark:bg-codeblock dark:ring-1 dark:ring-gray-800/50 codeblock-dark"><div class="min-w-full relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out" style="font-variant-ligatures:none;height:auto"><div class="overflow-x-auto h-full p-5 overflow-y-hidden scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-white/20 dark:scrollbar-thumb-white/20 hover:scrollbar-thumb-white/25 dark:hover:scrollbar-thumb-white/25 active:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25"><pre class="language-json"><code class="language-json"><span class=""><span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"object"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"properties"</span><span class="token operator">:</span> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"query"</span><span class="token operator">:</span> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"string"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"description"</span><span class="token operator">:</span> <span class="token string">"The keywords, author names or exact paper IDs to search for"</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"fields"</span><span class="token operator">:</span> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"string"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"description"</span><span class="token operator">:</span> <span class="token string">"The information to be returned, default as 'title,abstract,paperId,authors,year,url,referenceCount,citationCount'"</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"limit"</span><span class="token operator">:</span> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"string"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"description"</span><span class="token operator">:</span> <span class="token string">"The number of papers users want to get, default as 2. Use the default for all cases."</span></span>
<span class=""> <span class="token punctuation">}</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"required"</span><span class="token operator">:</span> <span class="token punctuation">[</span></span>
<span class=""> <span class="token string">"query"</span></span>
<span class=""> <span class="token punctuation">]</span></span>
<span class=""><span class="token punctuation">}</span></span>
<!-- -->
</code></pre></div></div></div>
<p>Notice that this is a structured JSON format. Under the key field “type” of the entire parameter-set, we put “object”. You should do the same for yours.</p>
<p>Under properties, you define each parameter along with their type and description. Take “query” for example. It has type String, meaning its data type is free text.
Types can be “String”, “integer”, “boolean”, “array”, etc. The description is more open-ended, but also extremely important. This is where you must tell
the LLM what this parameter represents. To the best of your ability, provide default values and examples of actual parameter values when the function is called.</p>
<p>Try to be as explicit as possible. Remember that if the AI has to guess whether a parameter named ‘language’ should take ‘en’ or ‘english’ as input, chances are
it will guess wrong, and you will see errors in your chatbot output.</p>
<p>Depending on the function you are working with, input parameters can get pretty complex. Below is another example for supplying parameters to a function (NOT related
to our Semantic Scholar example) that uses an array:</p>
<div class="mt-5 mb-8 not-prose rounded-2xl relative text-gray-50 bg-[#0F1117] dark:bg-codeblock dark:ring-1 dark:ring-gray-800/50 codeblock-dark"><div class="min-w-full relative text-sm leading-6 children:!my-0 children:!shadow-none children:!bg-transparent transition-[height] duration-300 ease-in-out" style="font-variant-ligatures:none;height:auto"><div class="overflow-x-auto h-full p-5 overflow-y-hidden scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-white/20 dark:scrollbar-thumb-white/20 hover:scrollbar-thumb-white/25 dark:hover:scrollbar-thumb-white/25 active:scrollbar-thumb-white/25 dark:active:scrollbar-thumb-white/25"><pre class="language-json"><code class="language-json"><span class=""><span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"object"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"properties"</span><span class="token operator">:</span> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"tags"</span><span class="token operator">:</span> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"array"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"description"</span><span class="token operator">:</span> <span class="token string">"labels that should be assigned to the user’s request"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"items"</span><span class="token operator">:</span> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"object"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"properties"</span><span class="token operator">:</span> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"name"</span><span class="token operator">:</span> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"string"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"description"</span><span class="token operator">:</span> <span class="token string">"The name of the label"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"color"</span><span class="token operator">:</span> <span class="token punctuation">{</span></span>
<span class=""> <span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"string"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"description"</span><span class="token operator">:</span> <span class="token string">"The color of the label"</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"required"</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">"name"</span><span class="token punctuation">,</span> <span class="token string">"color"</span><span class="token punctuation">]</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token punctuation">}</span><span class="token punctuation">,</span></span>
<span class=""> <span class="token property">"required"</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">"tags"</span><span class="token punctuation">]</span><span class="token punctuation">,</span></span>
<span class=""><span class="token punctuation">}</span></span>
</code></pre></div></div></div>
<p>The function can only be called once the “required” parameters have been collected. If necessary information is missing, the function cannot be invoked. You
must define which parameters are mandatory in order for the function to be called.</p>
<p>For additional information on the supported JSON schema, please reference this guide: <a href="https://json-schema.org/understanding-json-schema/reference/type" target="_blank" rel="noreferrer">https://json-schema.org/understanding-json-schema/reference/type</a></p>
<h2 class="flex whitespace-pre-wrap group" id="testing-the-chatbot"><div class="absolute"><a href="#testing-the-chatbot" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100" aria-label="Navigate to header"><div class="w-6 h-6 text-gray-400 rounded-md flex items-center justify-center zinc-box bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20"><svg xmlns="http://www.w3.org/2000/svg" fill="gray" height="12px" viewBox="0 0 576 512"><path d="M0 256C0 167.6 71.6 96 160 96h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C98.1 144 48 194.1 48 256s50.1 112 112 112h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C71.6 416 0 344.4 0 256zm576 0c0 88.4-71.6 160-160 160H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c61.9 0 112-50.1 112-112s-50.1-112-112-112H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c88.4 0 160 71.6 160 160zM184 232H392c13.3 0 24 10.7 24 24s-10.7 24-24 24H184c-13.3 0-24-10.7-24-24s10.7-24 24-24z"></path></svg></div></a></div><span class="cursor-pointer">Testing the chatbot</span></h2>
<p>Once everything is set up, save your function, then save the Agent. You can then test it out under “Preview” tab:</p>
<div><div class="p-2 not-prose relative bg-gray-50/50 rounded-2xl overflow-hidden dark:bg-gray-800/25"><div style="background-position:10px 10px" class="absolute inset-0 bg-grid-neutral-200/20 [mask-image:linear-gradient(0deg,#fff,rgba(255,255,255,0.6))] dark:bg-grid-white/5 dark:[mask-image:linear-gradient(0deg,rgba(255,255,255,0.1),rgba(255,255,255,0.5))]"></div><div class="relative rounded-xl overflow-hidden flex justify-center"></div><div class="absolute inset-0 pointer-events-none border border-black/5 rounded-2xl dark:border-white/5"></div></div></div>
<p>You can turn on the debug mode with the toggle on the top right corner of the screen. This will allow you to inspect the output of the function if it had been
called during the LLM response:</p>
<div><div class="p-2 not-prose relative bg-gray-50/50 rounded-2xl overflow-hidden dark:bg-gray-800/25"><div style="background-position:10px 10px" class="absolute inset-0 bg-grid-neutral-200/20 [mask-image:linear-gradient(0deg,#fff,rgba(255,255,255,0.6))] dark:bg-grid-white/5 dark:[mask-image:linear-gradient(0deg,rgba(255,255,255,0.1),rgba(255,255,255,0.5))]"></div><div class="relative rounded-xl overflow-hidden flex justify-center"></div><div class="absolute inset-0 pointer-events-none border border-black/5 rounded-2xl dark:border-white/5"></div></div></div>
<p>Just like that, you equipped your AI Agent with on-demand information from an external data provider. In the future, we will also write a guide that helps you
implement and host your own database search function that then gets integrated with GPT-trainer.</p></div><div class="leading-6 mt-14"><div class="mb-12 px-0.5 flex items-center text-sm font-semibold text-gray-700 dark:text-gray-200"><a class="flex items-center space-x-3 group" href="help.html"><svg viewBox="0 0 3 6" class="h-1.5 stroke-gray-400 overflow-visible group-hover:stroke-gray-600 dark:group-hover:stroke-gray-300"><path d="M3 0L0 3L3 6" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="group-hover:text-gray-900 dark:group-hover:text-white">Why does my chatbot not answer correctly?</span></a><a class="flex items-center ml-auto space-x-3 group" href="user-identity.html"><span class="group-hover:text-gray-900 dark:group-hover:text-white">User Identity Verification</span><svg viewBox="0 0 3 6" class="rotate-180 h-1.5 stroke-gray-400 overflow-visible group-hover:stroke-gray-600 dark:group-hover:stroke-gray-300"><path d="M3 0L0 3L3 6" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg></a></div><footer id="footer" class="flex gap-12 justify-between pt-10 border-t border-gray-100 sm:flex dark:border-gray-800/50 pb-28"><div class="flex items-center justify-between"><div class="sm:flex"><a href="https://mintlify.com/preview-request?utm_campaign=poweredBy&utm_medium=docs&utm_source=guide.gpt-trainer.com" target="_blank" rel="noreferrer" class="text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">Powered by Mintlify</a></div></div></footer></div></div><div class="z-10 hidden xl:flex pl-10 box-border w-[19rem]" id="table-of-contents"><div id="table-of-contents-content" class="fixed text-gray-600 text-sm leading-6 w-[16.5rem] overflow-y-auto space-y-2 h-[calc(100%-7rem)]"><div class="text-gray-700 dark:text-gray-300 font-medium flex items-center space-x-2"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" xmlns="http://www.w3.org/2000/svg" class="h-3 w-3"><path d="M2.44434 12.6665H13.5554" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.44434 3.3335H13.5554" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.44434 8H7.33323" stroke-linecap="round" stroke-linejoin="round"></path></svg><span>On this page</span></div><ul><li><a href="#setting-up-and-testing-the-function" class="py-1 block hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300">Setting up and testing the function</a></li><li><a href="#create-and-prepare-the-ai-agent" class="py-1 block hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300">Create and prepare the AI Agent</a></li><li><a href="#function-setup" class="py-1 block hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300">Function setup</a></li><li><a href="#fixed-parameters" class="py-1 block hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300">Fixed parameters</a></li><li><a href="#headers-and-authentication" class="py-1 block hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300">Headers and Authentication</a></li><li><a href="#variable-parameters" class="py-1 block hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300">Variable parameters</a></li><li><a href="#testing-the-chatbot" class="py-1 block hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300">Testing the chatbot</a></li></ul></div></div></div></div></div></div></main></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"mdxSource":{"compiledSource":"\"use strict\";\nconst {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n a: \"a\",\n code: \"code\",\n p: \"p\",\n pre: \"pre\",\n span: \"span\",\n ..._provideComponents(),\n ...props.components\n }, {CodeBlock, Frame, Heading, Note, ZoomImage} = _components;\n if (!CodeBlock) _missingMdxReference(\"CodeBlock\", true);\n if (!Frame) _missingMdxReference(\"Frame\", true);\n if (!Heading) _missingMdxReference(\"Heading\", true);\n if (!Note) _missingMdxReference(\"Note\", true);\n if (!ZoomImage) _missingMdxReference(\"ZoomImage\", true);\n return _jsxs(_Fragment, {\n children: [_jsx(_components.p, {\n children: \"Uploading static sources as training data for your AI Agents is well and good, but what if your database is huge, structured, externally-hosted,\\nor updated in real-time? There is no way to dump the entire database into GPT-trainer’s static knowledge library and still maintain a live link…\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"This is where function-calling comes in. Through function-calling, you can serve data on-demand to your AI Agent in GPT-trainer during a live\\nconversation session. To show you how, we walk you through an example of RAG enrichment using (abstracts of) academic papers sourced from a trusted\\nacademic papers aggregator: Semantic Scholar API.\"\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"setting-up-and-testing-the-function\",\n children: \"Setting up and testing the function\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"First, you’ll need an API key from your external data provider, whoever that may be, assuming they have a secure API. In our case, we requested one\\nfrom \", _jsx(_components.a, {\n href: \"https://www.semanticscholar.org/\",\n children: \"Semantic Scholar\"\n }), \" directly.\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"Since we want to enrich our LLM query response with relevant information from academic research, we need to find the appropriate API endpoint to\\nconduct the search. Semantic Scholar offers nice \", _jsx(_components.a, {\n href: \"https://api.semanticscholar.org/api-docs/graph#tag/Paper-Data/operation/get_graph_paper_relevance_search\",\n children: \"documentation\"\n }), \"\\nin that regard.\"]\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-1.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"So what does this API endpoint respond with?\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"To inspect the output, we ran a script that makes a request to the API based on hardcoded input parameters. The source code of our script is included\\nbelow. You will need your own Semantic Scholar API key if you wish to run it yourself. For our example, we ran a search for relevant papers on the topic\\nof “Multifidelity Optimization” and “Gaussian Processes”.\"\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-python\",\n children: _jsxs(_components.code, {\n className: \"language-python\",\n children: [_jsxs(_components.span, {\n className: \"\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" requests\"]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" json\"]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" os\"]\n }), \"\\n\", \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Set up the headers with the API key\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\"headers \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"'X-API-KEY'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"YOUR OWN API KEY\\\"\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })\n }), \"\\n\", \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Specify the fields you want to fetch for each recommended paper\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\"fields \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"paperId,title,authors,abstract,url,referenceCount\\\"\"\n })]\n }), \"\\n\", \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Define the limit for the number of recommendations to return\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\"limit \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"20\"\n })]\n }), \"\\n\", \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Make the request to get paper recommendations\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\"response \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" requests\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"get\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"'https://api.semanticscholar.org/graph/v1/paper/search'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" headers\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \"headers\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token comment\",\n children: \"# json=payload,\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" params\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'fields'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \" fields\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"'limit'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \" limit\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"'query'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'multifidelity optimization, gaussian processes'\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n })\n }), \"\\n\", \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Check if the request was successful\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"if\"\n }), \" response\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"status_code \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"==\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"200\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"print\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"json\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"dumps\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"response\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"json\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" indent\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token number\",\n children: \"2\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"else\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"print\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsxs(_components.span, {\n className: \"token string-interpolation\",\n children: [_jsx(_components.span, {\n className: \"token string\",\n children: \"f\\\"Error: \"\n }), _jsxs(_components.span, {\n className: \"token interpolation\",\n children: [_jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n }), \"response\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"status_code\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"\"\n })]\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token comment\",\n children: \"# It's better to print response.text for non-200 responses, as they may not be in JSON format\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"print\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"response\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"text\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n })]\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"The output we received looks like follows:\"\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-json\",\n children: _jsxs(_components.code, {\n className: \"language-json\",\n children: [_jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"total\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"12096\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"offset\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"0\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"next\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"20\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"data\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"paperId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"b108e6e11f4a96d5058945f3b582a032e8204ade\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"url\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"https://www.semanticscholar.org/paper/b108e6e11f4a96d5058945f3b582a032e8204ade\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"title\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Multifidelity Gaussian processes for failure boundary andprobability estimation\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"abstract\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Estimating probability of failure in aerospace systems is a critical requirement for flight certification and qualification. Failure probability estimation (FPE) involves resolving tails of probability distribution and Monte Carlo (MC) sampling methods are intractable when expensive high-fidelity simulations have to be queried. We propose a method to use models of multiple fidelities, which trade accuracy for computational efficiency. Specifically, we propose the use of multifidelity Gaussian process models to efficiently fuse models at multiple fidelity. Furthermore, we propose a novel acquisition function within a Bayesian optimization framework, which can sequentially select samples (or batches of samples for parallel evaluation) from appropriate fidelity models to make predictions about quantities of interest in the highest fidelity. We use our proposed approach within a multifidelity importance sampling (MFIS) setting, and demonstrate our method on the failure level set estimation on synthetic test functions as well as the transonic flow past an airfoil wing section.\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"referenceCount\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"49\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authors\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"98543101\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Ashwin Renganathan\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"144321616\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Vishwas Rao\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"143672238\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Ionel M. Navon\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"paperId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"963a5c60ada159d27641a284008f57d6419b26f2\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"url\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"https://www.semanticscholar.org/paper/963a5c60ada159d27641a284008f57d6419b26f2\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"title\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Generative Transfer Optimization for Aerodynamic Design\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"abstract\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Transfer optimization, one type of optimization methods, which leverages knowledge of the completed tasks to accelerate the design progress of a new task, has been in widespread use in machine learning community. However, when applying transfer optimization to accelerate the progress of aerodynamic shape optimization (ASO), two challenges are encountered in sequence, that is, (1) how to build a shared design space among the related aerodynamic design tasks, and (2) how to exchange information between tasks most efficiently. To address the first challenge, a datadriven generative model is used to learn airfoil representations from the existing database, with the aim of synthesizing various airfoil shapes in a shared design space. To address the second challenge, both singleand multifidelity Gaussian processes (GPs) are employed to carry out optimization. On one hand, the multifidelity GP is used to leverage knowledge from the completed tasks. On the other hand, mutual learning is established between singleand multifidelity GP models by exchanging information between them in each optimization cycle. With the above, a generative transfer optimization (GTO) framework is proposed to shorten the design cycle of aerodynamic design. Through airfoil optimizations at different working conditions, the effectiveness of the proposed GTO framework is demonstrated.\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"referenceCount\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"16\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authors\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"2149505113\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Zhendong Guo\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"2153199285\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Wei Sun\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"50258957\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Liming Song\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"46276037\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Jun Yu Li\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"73325644\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Z. Feng\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"… (truncated due to length)\"\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"The Semantic Scholar function returned the top 20 matching results ranked by relevance based on our input parameter specification. As you see, the response\\ncan get quite long, so we truncated the output for conciseness.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Ideally, you want a structured JSON response from the function’s output like what we showed above.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"We ran our own analysis for this particular API endpoint (with the specific set of output fields we requested) and found that on average, each returned\\nresult is between 400-500 tokens long. This means that depending on the token limit we reserved for the function output, we can only fit so many search results\\nin before running out of space. Keep this in mind as you prioritize the information you wish to supply to the LLM during RAG.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Now we know what the LLM would see as additional context provided by the function call, we can start linking it to our GPT-trainer Agent.\"\n }), \"\\n\", _jsx(Note, {\n children: _jsx(_components.p, {\n children: \"It is ALWAYS advisable to write your own script and test for the output of the API endpoint first. You want to know exactly what kind information\\nis being fed into your AI Agent.\"\n })\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"create-and-prepare-the-ai-agent\",\n children: \"Create and prepare the AI Agent\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"In your chatbot inside GPT-trainer, you must first create an appropriate AI Agent that you plan to give this function-calling capability to. In our example,\\nwe created “The Professor”. We then defined an associated Agent description and base prompt.\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-2.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"We picked the GPT-4-0125-8k Model for this example. You can see our simple prompt in the screenshot below.\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-3.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"Next, we save the Agent and go to the “Knowledge” tab to disable static RAG from the chatbot’s own knowledge library. This is only necessary if you don’t want\\nto use any training data from the static sources list. In our example, we didn’t upload any training data anyways, but we do this as standard practice to keep\\nthings clean.\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-4.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"Save the Agent.\"\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"function-setup\",\n children: \"Function setup\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Within your Agent, head over to the “Functions” tab. Change the “Response Context Limit” to the maximum allowed. Then click “Add function”.\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-5.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"This is where you tell the LLM exactly what the function does and how it works. The LLM will then decide on its own whether it needs the function when responding\\nto the user during a conversation, then call it with the appropriate parameters as needed.\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-6.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"The function name and description are particularly useful in helping the AI understand what the function does. Please make sure to be as explicit as possible in\\nyour own definition. The function description must be less than 1024 characters, including spaces. In our case, we wrote the following:\"\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-plaintext\",\n children: _jsxs(_components.code, {\n children: [_jsx(_components.span, {\n className: \"\",\n children: \"Function name: paper_relevance_search\"\n }), \"\\n\", \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"Function description: \"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"This function searches Semantic Scholar, a scholarly literature database. The input parameters will be defined based on extracted information from conversation context. It will return search results containing academic paper metadata (with abstracts) in a JSON format.\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"The returned fields are defined as follows:\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- title: paper title\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- abstract: paper abstract\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- paperId: paper uuid\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- authors: paper authors\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- year: paper publication year\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- url: paper link\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- referenceCount: number of references included in the paper\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- citationCount: number of citations of this paper\"\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"Next, define the API endpoint. The Semantic Scholar endpoint we are using is simple and straighforward:\"\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-plaintext\",\n children: _jsxs(_components.code, {\n children: [_jsx(_components.span, {\n className: \"\",\n children: \"https://api.semanticscholar.org/graph/v1/paper/search\"\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"After that, choose the HTTP method. We use “GET” for our example. The specific API endpoint you are using should have documentation about this distinction.\"\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"fixed-parameters\",\n children: \"Fixed parameters\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Static (Fixed) Parameters remain constant across all API requests. They are pre-defined and reflect settings or configurations that do not change with each\\ncall. For example, parameters that specify the format of the response or that enable/disable certain features globally across all API interactions fall into\\nthis category. The term “static” emphasizes their unchanging nature.\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"Depending on your particular API endpoint, you may need to append some fixed parameters in the URL. The API we use above from Semantic Scholar does not require\\nfixed parameters. But if you are using a more complex endpoint like this:\\n\", _jsx(_components.a, {\n href: \"https://app.outscraper.com/api-docs#tag/Businesses-and-POI/paths/~1maps~1search-v3/get\",\n children: \"https://app.outscraper.com/api-docs#tag/Businesses-and-POI/paths/~1maps~1search-v3/get\"\n }), \", then your API endpoint may include fixed parameters and look something like:\"]\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-plaintext\",\n children: _jsxs(_components.code, {\n children: [_jsx(_components.span, {\n className: \"\",\n children: \"https://api.app.outscraper.com/maps/search-v3?async=false\u0026fields=name,full_address,phone,site\"\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"Notice that at the end of “\", _jsx(_components.a, {\n href: \"https://api.app.outscraper.com/maps/search-v3\",\n children: \"https://api.app.outscraper.com/maps/search-v3\"\n }), \"”, we get into fixed parameters. This is where you define parameters that will not change\\nwhen the function is called. Always define fixed parameters this way!\"]\n }), \"\\n\", _jsx(Note, {\n children: _jsx(_components.p, {\n children: \"If your API is capable of returning a more concise response by configuring certain parameters (i.e., tell the API to leave out unnecessary metadata in the response),\\nthen we highly suggest that you do so. It will reduce token waste and help AI understand the context better. In the above example, we set “fields=name,full_address,phone,site”\\nspecifically to limit the response so that it contains only name, full_address, phone, and site information - and nothing else.\"\n })\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"headers-and-authentication\",\n children: \"Headers and Authentication\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"In general, secure public-facing APIs require authentication. Semantic Scholar is the same. In the Header, we provide our API key. The specific key field used\\nto supply your authentication token will differ based on the particular API you use, so please make sure to be informed on your API provider’s documentation.\\nFor our example, the key field is named “x-api-key”:\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-7.png\"\n })\n })\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"variable-parameters\",\n children: \"Variable parameters\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Finally, we get to variable parameters.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Variable (Dynamic) Parameters dynamically change based on user input or conversation context, unlike their static counterparts. In function calling, these parameters\\nadapt to the specifics of each request, being determined at runtime. This ensures that API calls made by the AI are tailored to the immediate needs of the conversation,\\nenabling a more personalized and relevant interaction. The AI extracts these parameters directly from the dialogue, determining when and how to call the function\\nbased on the ongoing conversation.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"For our function, we define the following variable parameters:\"\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-json\",\n children: _jsxs(_components.code, {\n className: \"language-json\",\n children: [_jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"object\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"properties\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"query\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"string\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"description\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"The keywords, author names or exact paper IDs to search for\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"fields\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"string\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"description\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"The information to be returned, default as 'title,abstract,paperId,authors,year,url,referenceCount,citationCount'\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"limit\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"string\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"description\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"The number of papers users want to get, default as 2. Use the default for all cases.\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"required\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"query\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })\n }), \"\\n\", \"\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"Notice that this is a structured JSON format. Under the key field “type” of the entire parameter-set, we put “object”. You should do the same for yours.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Under properties, you define each parameter along with their type and description. Take “query” for example. It has type String, meaning its data type is free text.\\nTypes can be “String”, “integer”, “boolean”, “array”, etc. The description is more open-ended, but also extremely important. This is where you must tell\\nthe LLM what this parameter represents. To the best of your ability, provide default values and examples of actual parameter values when the function is called.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Try to be as explicit as possible. Remember that if the AI has to guess whether a parameter named ‘language’ should take ‘en’ or ‘english’ as input, chances are\\nit will guess wrong, and you will see errors in your chatbot output.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Depending on the function you are working with, input parameters can get pretty complex. Below is another example for supplying parameters to a function (NOT related\\nto our Semantic Scholar example) that uses an array:\"\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-json\",\n children: _jsxs(_components.code, {\n className: \"language-json\",\n children: [_jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"object\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"properties\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"tags\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"array\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"description\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"labels that should be assigned to the user’s request\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"items\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"object\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"properties\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"string\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"description\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"The name of the label\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"color\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"string\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"description\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"The color of the label\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"required\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"color\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"required\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"tags\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"The function can only be called once the “required” parameters have been collected. If necessary information is missing, the function cannot be invoked. You\\nmust define which parameters are mandatory in order for the function to be called.\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"For additional information on the supported JSON schema, please reference this guide: \", _jsx(_components.a, {\n href: \"https://json-schema.org/understanding-json-schema/reference/type\",\n children: \"https://json-schema.org/understanding-json-schema/reference/type\"\n })]\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"testing-the-chatbot\",\n children: \"Testing the chatbot\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Once everything is set up, save your function, then save the Agent. You can then test it out under “Preview” tab:\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-8.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"You can turn on the debug mode with the toggle on the top right corner of the screen. This will allow you to inspect the output of the function if it had been\\ncalled during the LLM response:\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-9.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"Just like that, you equipped your AI Agent with on-demand information from an external data provider. In the future, we will also write a guide that helps you\\nimplement and host your own database search function that then gets integrated with GPT-trainer.\"\n })]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\nfunction _missingMdxReference(id, component) {\n throw new Error(\"Expected \" + (component ? \"component\" : \"object\") + \" `\" + id + \"` to be defined: you likely forgot to import, pass, or provide it.\");\n}\n","frontmatter":{},"scope":{"mintConfig":{"$schema":"https://mintlify.com/schema.json","name":"GPT-trainer API","logo":{"light":"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/logo/light.svg","dark":"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/logo/dark.svg"},"favicon":"/logo/favicon.png","api":{"baseUrl":"https://app.gpt-trainer.com/api","auth":{"method":"bearer"}},"colors":{"primary":"#2E3F51","light":"#516F90","dark":"#0D001D","background":{"dark":"#111827"},"anchors":{"from":"#ED727B","to":"#F6B7BB"}},"topbarLinks":[{"url":"mailto:hello@gpt-trainer.com","name":"Support","_id":"676a0adaff1411a490c729a2"}],"navigation":[{"group":"Getting Started","pages":["introduction"]},{"group":"Guides","pages":["creating-first-chatbot","lead-collection","human-support-escalation","inbox-notifications","conversation-labeling","multi-agents-chatbot","fine-tuning-agent-intents","supervisor-overrides","byok-pricing-guide","working-with-tables","best-practices","help"]},{"group":"Function Calling","pages":["rag-from-external-data-provider"]},{"group":"API Usage Guides","pages":["api-reference/api-key-setup","api-reference/guide-00-chatbot-create","api-reference/guide-01-chat","api-reference/guide-02-source"]},{"group":"Authentication Webhook","pages":["user-identity"]},{"group":"Chatbots","pages":["api-reference/chatbots/properties-reference","api-reference/chatbots/create","api-reference/chatbots/update","api-reference/chatbots/fetch","api-reference/chatbots/fetch_multi","api-reference/chatbots/delete"]},{"group":"Agents","pages":["api-reference/agents/properties-reference","api-reference/agents/create","api-reference/agents/update","api-reference/agents/fetch_multi","api-reference/agents/delete"]},{"group":"Chatbot Sessions","pages":["api-reference/sessions/properties-reference","api-reference/sessions/create","api-reference/sessions/fetch","api-reference/sessions/fetch_multi","api-reference/sessions/delete","api-reference/sessions/delete_multi"]},{"group":"Session Messages","pages":["api-reference/messages/properties-reference","api-reference/messages/create","api-reference/messages/fetch_multi","api-reference/messages/delete","api-reference/messages/delete_multi"]},{"group":"Data Sources","pages":["api-reference/data-sources/properties-reference","api-reference/data-sources/create-file","api-reference/data-sources/create-qa","api-reference/data-sources/create-url","api-reference/data-sources/update","api-reference/data-sources/fetch_multi","api-reference/data-sources/retrain","api-reference/data-sources/delete","api-reference/data-sources/delete_multi"]},{"group":"Data Source Tags","pages":["api-reference/source-tags/create","api-reference/source-tags/fetch-multi","api-reference/source-tags/update","api-reference/source-tags/delete"]},{"group":"Tool Guides","pages":["tools/tools-intro"]},{"group":"Tools","pages":["tools/weekday"]},{"group":"Whitelabel Dashboard","pages":["whitelabel/whitelabel-intro","whitelabel/whitelabel-plans","whitelabel/whitelabel-users"]},{"group":"Integrations","pages":["whitelabel/whitelabel-zapier","whitelabel/whitelabel-make","whitelabel/whitelabel-meta"]}],"primaryTab":{"name":"Documentation"},"anchors":[{"name":"API References","url":"api-reference","icon":"code","_id":"676a0adaff1411a490c7299f"},{"name":"Tools","url":"tools","icon":"gear","_id":"676a0adaff1411a490c729a0"},{"name":"Whitelabel","url":"whitelabel","icon":"browser","_id":"676a0adaff1411a490c729a1"}],"repo":{"github":{"owner":"ks-collab","repo":"gpt-trainer-docs","contentDirectory":"","deployBranch":"main","isPrivate":false}}},"pageMetadata":{"title":"RAG from an External Data Provider","description":null,"href":"/rag-from-external-data-provider"}}},"mdxExtracts":{"tableOfContents":[{"title":"Setting up and testing the function","slug":"setting-up-and-testing-the-function","depth":2,"children":[]},{"title":"Create and prepare the AI Agent","slug":"create-and-prepare-the-ai-agent","depth":2,"children":[]},{"title":"Function setup","slug":"function-setup","depth":2,"children":[]},{"title":"Fixed parameters","slug":"fixed-parameters","depth":2,"children":[]},{"title":"Headers and Authentication","slug":"headers-and-authentication","depth":2,"children":[]},{"title":"Variable parameters","slug":"variable-parameters","depth":2,"children":[]},{"title":"Testing the chatbot","slug":"testing-the-chatbot","depth":2,"children":[]}],"codeExamples":{}},"description":null,"pageData":{"navWithMetadata":[{"group":"Getting Started","pages":[{"title":"Introduction","description":null,"href":"/introduction"}]},{"group":"Guides","pages":[{"title":"Create Your First Chatbot","description":null,"href":"/creating-first-chatbot"},{"title":"Lead Collection","description":null,"href":"/lead-collection"},{"title":"Human Support Escalation","description":null,"href":"/human-support-escalation"},{"title":"Inbox Notifications","description":null,"href":"/inbox-notifications"},{"title":"Conversation Labeling","description":null,"href":"/conversation-labeling"},{"title":"Multi-Agents Chatbot","description":null,"href":"/multi-agents-chatbot"},{"title":"Fine Tuning Agent Intents","description":null,"href":"/fine-tuning-agent-intents"},{"title":"AI Supervisor Overrides","description":null,"href":"/supervisor-overrides"},{"title":"Bring Your Own Key (BYOK) and Pricing","description":null,"href":"/byok-pricing-guide"},{"title":"Working with Tables and CSV","description":null,"href":"/working-with-tables"},{"title":"Best practices for preparing training data","description":null,"href":"/best-practices"},{"title":"Why does my chatbot not answer correctly?","description":null,"href":"/help"}]},{"group":"Function Calling","pages":[{"title":"RAG from an External Data Provider","description":null,"href":"/rag-from-external-data-provider"}]},{"group":"API Usage Guides","pages":[{"title":"Getting a GPT-trainer API Key","description":null,"href":"/api-reference/api-key-setup"},{"title":"Create Chabot","description":null,"href":"/api-reference/guide-00-chatbot-create"},{"title":"Chat with Chatbot","description":null,"href":"/api-reference/guide-01-chat"},{"title":"Uploading Data Sources","description":null,"href":"/api-reference/guide-02-source"}]},{"group":"Authentication Webhook","pages":[{"title":"User Identity Verification","description":null,"href":"/user-identity"}]},{"group":"Chatbots","pages":[{"title":"Chatbot Properties","description":"Detailed explanation of chatbot's properties","href":"/api-reference/chatbots/properties-reference"},{"title":"Create Chatbot","description":"Create a chatbot that belongs to the authenticated user","api":"POST https://app.gpt-trainer.com/api/v1/chatbot/create","href":"/api-reference/chatbots/create"},{"title":"Update Chatbot","description":"Update chatbot meta base on uuid","api":"POST https://app.gpt-trainer.com/api/v1/chatbot/{uuid}/update","href":"/api-reference/chatbots/update"},{"title":"Fetch a Chatbot","description":"Fetch single chatbot base on uuid","api":"GET https://app.gpt-trainer.com/api/v1/chatbot/{uuid}","href":"/api-reference/chatbots/fetch"},{"title":"Fetch all Chatbots","description":"Fetch the list of chatbots for current user","api":"GET https://app.gpt-trainer.com/api/v1/chatbots","href":"/api-reference/chatbots/fetch_multi"},{"title":"Delete Chatbot","description":"Delete single chatbot base on uuid","api":"DELETE https://app.gpt-trainer.com/api/v1/chatbot/{uuid}/delete","href":"/api-reference/chatbots/delete"}]},{"group":"Agents","pages":[{"title":"Agent Properties","description":"Detailed explanation of agent's properties","href":"/api-reference/agents/properties-reference"},{"title":"Create Agent","description":"Create an agent for a chatbot specified by chatbot uuid","api":"POST https://app.gpt-trainer.com/api/v1/chatbot/\u003cuuid\u003e/agent/create","href":"/api-reference/agents/create"},{"title":"Update Agent","description":"Update agent meta based on uuid","api":"POST https://app.gpt-trainer.com/api/v1/agent/{uuid}/update","href":"/api-reference/agents/update"},{"title":"Fetch all Agents","description":"Fetch the list of agents for a chatbot specified by chatbot uuid","api":"GET https://app.gpt-trainer.com/api/v1/chatbot/{uuid}/agents","href":"/api-reference/agents/fetch_multi"},{"title":"Delete Agent","description":"Delete single agent base on uuid","api":"DELETE https://app.gpt-trainer.com/api/v1/agent/{uuid}/delete","href":"/api-reference/agents/delete"}]},{"group":"Chatbot Sessions","pages":[{"title":"Session Properties","description":"Detailed explanation of sessions's properties","href":"/api-reference/sessions/properties-reference"},{"title":"Create Session","description":"Create a chat session for a chatbot specified by chatbot uuid","api":"POST https://app.gpt-trainer.com/api/v1/chatbot/{uuid}/session/create","href":"/api-reference/sessions/create"},{"title":"Fetch a Session","description":"Fetch single chatbot session base on uuid","api":"GET https://app.gpt-trainer.com/api/v1/session/{uuid}","href":"/api-reference/sessions/fetch"},{"title":"Fetch all Sessions","description":"Fetch the list of sessions for a chatbot specified by chatbot uuid","api":"GET https://app.gpt-trainer.com/api/v1/chatbot/{uuid}/sessions","href":"/api-reference/sessions/fetch_multi"},{"title":"Delete Session","description":"Delete a session by its UUID","api":"POST https://app.gpt-trainer.com/api/v1/session/{uuid}/delete","href":"/api-reference/sessions/delete"},{"title":"Delete Session","description":"Delete a session by its UUID","api":"POST https://app.gpt-trainer.com/api/v1/session/{uuid}/delete","href":"/api-reference/sessions/delete_multi"}]},{"group":"Session Messages","pages":[{"title":"Message Properties","description":"Detailed explanation of message's properties","href":"/api-reference/messages/properties-reference"},{"title":"Create Message","description":"Create a session message for a chatbot session specified by session uuid","api":"POST https://app.gpt-trainer.com/api/v1/session/{uuid}/message/stream","href":"/api-reference/messages/create"},{"title":"Fetch all Messages","description":"Fetch the list of messages for a session specified by session uuid","api":"GET https://app.gpt-trainer.com/api/v1/session/{uuid}/messages","href":"/api-reference/messages/fetch_multi"},{"title":"Delete Message","description":"Delete single message base on uuid","api":"POST https://app.gpt-trainer.com/api/v1/message/{uuid}/delete","href":"/api-reference/messages/delete"},{"title":"Delete multiple Messages","description":"Delete list of messages base on their uuids","api":"POST https://app.gpt-trainer.com/api/v1/messages/delete","href":"/api-reference/messages/delete_multi"}]},{"group":"Data Sources","pages":[{"title":"Source properties","description":"Detailed explanation of source's properties","href":"/api-reference/data-sources/properties-reference"},{"title":"Upload a File","description":"Create a File source for a chatbot specified by chatbot uuid","api":"POST https://app.gpt-trainer.com/api/v1/chatbot/{uuid}/data-source/upload","href":"/api-reference/data-sources/create-file"},{"title":"Create QA Source","description":"Create a QA source for a chatbot specified by chatbot uuid","api":"POST https://app.gpt-trainer.com/api/v1/chatbot/{uuid}/data-source/qa","href":"/api-reference/data-sources/create-qa"},{"title":"Create URL Source","description":"Create a URL source for a chatbot specified by chatbot uuid","api":"POST https://app.gpt-trainer.com/api/v1/chatbot/{uuid}/data-source/url","href":"/api-reference/data-sources/create-url"},{"title":"Update Source","description":"Update source meta base on uuid","api":"POST https://app.gpt-trainer.com/api/v1/data-source/{uuid}/update","href":"/api-reference/data-sources/update"},{"title":"Fetch list of Sources","description":"Fetch the list of sources for a chatbot specified by chatbot uuid","api":"GET https://app.gpt-trainer.com/api/v1/chatbot/{uuid}/data-sources","href":"/api-reference/data-sources/fetch_multi"},{"title":"Retrain Sources","description":"Retrain multiple URL data sources to fetch the latest content from them.","api":"POST https://app.gpt-trainer.com/api/v1/data-sources/url/re-scrape","href":"/api-reference/data-sources/retrain"},{"title":"Delete Source","description":"Delete single source base on uuid","api":"POST https://app.gpt-trainer.com/api/v1/data-source/{uuid}/delete","href":"/api-reference/data-sources/delete"},{"title":"Delete multiple Sources","description":"Delete list of sources base on their uuids","api":"POST https://app.gpt-trainer.com/api/v1/data-sources/delete","href":"/api-reference/data-sources/delete_multi"}]},{"group":"Data Source Tags","pages":[{"title":"Create Source Tag","description":"Create a source tag for a chabot. Source tags can be used to organize sources.","api":"POST https://app.gpt-trainer.com/api/v1/chatbot/\u003cuuid\u003e/source-tag/create","href":"/api-reference/source-tags/create"},{"title":"Fetch all Source Tags","description":"List all source tags for a chabot.","api":"GET https://app.gpt-trainer.com/api/v1/chatbot/\u003cuuid\u003e/source-tags","href":"/api-reference/source-tags/fetch-multi"},{"title":"Update Source Tag","description":"Update the properties of a source tag, including its list of documents.","api":"POST https://app.gpt-trainer.com/api/v1/source-tag/\u003cuuid\u003e/update","href":"/api-reference/source-tags/update"},{"title":"Delete Source Tag","description":"Delete a source tag based on uuid","api":"DELETE https://app.gpt-trainer.com/api/v1/source-tag/{uuid}/delete","href":"/api-reference/source-tags/delete"}]},{"group":"Tool Guides","pages":[{"title":"Introduction","description":null,"href":"/tools/tools-intro"}]},{"group":"Tools","pages":[{"title":"Weekday","description":"This function finds the day of the week, given a date. For example, given the date '2024-10-07', it will return a JSON: `{'weekday': 'Monday'}`","api":"GET https://tools.gpt-trainer.com/weekday","href":"/tools/weekday"}]},{"group":"Whitelabel Dashboard","pages":[{"title":"Introduction and first-time setup","description":null,"href":"/whitelabel/whitelabel-intro"},{"title":"Creating plans and pricing considerations","description":null,"href":"/whitelabel/whitelabel-plans"},{"title":"Managing your users","description":null,"href":"/whitelabel/whitelabel-users"}]},{"group":"Integrations","pages":[{"title":"Publishing a Zapier app","description":null,"href":"/whitelabel/whitelabel-zapier"},{"title":"Publishing a Make app","description":null,"href":"/whitelabel/whitelabel-make"},{"title":"Adding Meta integrations","description":null,"href":"/whitelabel/whitelabel-meta"}]}],"pageMetadata":{"title":"RAG from an External Data Provider","description":null,"href":"/rag-from-external-data-provider"},"mintConfig":{"layout":"topnav","sidebar":{"items":"container"},"topbar":{"style":"default"},"search":{"location":"top"},"rounded":"default","codeBlock":{"mode":"dark"},"$schema":"https://mintlify.com/schema.json","name":"GPT-trainer API","logo":{"light":"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/logo/light.svg","dark":"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/logo/dark.svg"},"favicon":"/logo/favicon.png","api":{"baseUrl":"https://app.gpt-trainer.com/api","auth":{"method":"bearer"}},"colors":{"primary":"#2E3F51","light":"#516F90","dark":"#0D001D","background":{"dark":"#111827"},"anchors":{"from":"#ED727B","to":"#F6B7BB"}},"topbarLinks":[{"url":"mailto:hello@gpt-trainer.com","name":"Support","_id":"676a0adaff1411a490c729a2"}],"navigation":[{"group":"Getting Started","pages":["introduction"]},{"group":"Guides","pages":["creating-first-chatbot","lead-collection","human-support-escalation","inbox-notifications","conversation-labeling","multi-agents-chatbot","fine-tuning-agent-intents","supervisor-overrides","byok-pricing-guide","working-with-tables","best-practices","help"]},{"group":"Function Calling","pages":["rag-from-external-data-provider"]},{"group":"API Usage Guides","pages":["api-reference/api-key-setup","api-reference/guide-00-chatbot-create","api-reference/guide-01-chat","api-reference/guide-02-source"]},{"group":"Authentication Webhook","pages":["user-identity"]},{"group":"Chatbots","pages":["api-reference/chatbots/properties-reference","api-reference/chatbots/create","api-reference/chatbots/update","api-reference/chatbots/fetch","api-reference/chatbots/fetch_multi","api-reference/chatbots/delete"]},{"group":"Agents","pages":["api-reference/agents/properties-reference","api-reference/agents/create","api-reference/agents/update","api-reference/agents/fetch_multi","api-reference/agents/delete"]},{"group":"Chatbot Sessions","pages":["api-reference/sessions/properties-reference","api-reference/sessions/create","api-reference/sessions/fetch","api-reference/sessions/fetch_multi","api-reference/sessions/delete","api-reference/sessions/delete_multi"]},{"group":"Session Messages","pages":["api-reference/messages/properties-reference","api-reference/messages/create","api-reference/messages/fetch_multi","api-reference/messages/delete","api-reference/messages/delete_multi"]},{"group":"Data Sources","pages":["api-reference/data-sources/properties-reference","api-reference/data-sources/create-file","api-reference/data-sources/create-qa","api-reference/data-sources/create-url","api-reference/data-sources/update","api-reference/data-sources/fetch_multi","api-reference/data-sources/retrain","api-reference/data-sources/delete","api-reference/data-sources/delete_multi"]},{"group":"Data Source Tags","pages":["api-reference/source-tags/create","api-reference/source-tags/fetch-multi","api-reference/source-tags/update","api-reference/source-tags/delete"]},{"group":"Tool Guides","pages":["tools/tools-intro"]},{"group":"Tools","pages":["tools/weekday"]},{"group":"Whitelabel Dashboard","pages":["whitelabel/whitelabel-intro","whitelabel/whitelabel-plans","whitelabel/whitelabel-users"]},{"group":"Integrations","pages":["whitelabel/whitelabel-zapier","whitelabel/whitelabel-make","whitelabel/whitelabel-meta"]}],"primaryTab":{"name":"Documentation"},"anchors":[{"name":"API References","url":"api-reference","icon":"code","_id":"676a0adaff1411a490c7299f"},{"name":"Tools","url":"tools","icon":"gear","_id":"676a0adaff1411a490c729a0"},{"name":"Whitelabel","url":"whitelabel","icon":"browser","_id":"676a0adaff1411a490c729a1"}],"repo":{"github":{"owner":"ks-collab","repo":"gpt-trainer-docs","contentDirectory":"","deployBranch":"main","isPrivate":false}}},"apiReferenceData":{}},"favicons":{"icons":[{"rel":"apple-touch-icon","sizes":"180x180","href":"https://mintlify.s3-us-west-1.amazonaws.com/paladinmaxinc/_generated/favicon/apple-touch-icon.png?v=3","type":"image/png"},{"rel":"icon","sizes":"32x32","href":"https://mintlify.s3-us-west-1.amazonaws.com/paladinmaxinc/_generated/favicon/favicon-32x32.png?v=3","type":"image/png"},{"rel":"icon","sizes":"16x16","href":"https://mintlify.s3-us-west-1.amazonaws.com/paladinmaxinc/_generated/favicon/favicon-16x16.png?v=3","type":"image/png"},{"rel":"shortcut icon","href":"https://mintlify.s3-us-west-1.amazonaws.com/paladinmaxinc/_generated/favicon/favicon.ico?v=3","type":"image/x-icon"}],"browserconfig":"https://mintlify.s3-us-west-1.amazonaws.com/paladinmaxinc/_generated/favicon/browserconfig.xml?v=3"},"subdomain":"guide.gpt-trainer.com","internalAnalyticsWriteKey":"phc_TXdpocbGVeZVm5VJmAsHTMrCofBQu3e0kN8HGMNGTVW","inkeep":{"integrationApiKey":"4f40617e2acf6b9193ebf897d3ed2d80d831b9c5b431b91d"},"trieve":{"datasetId":"5f00ed3a-c71f-499e-8e71-5e23e2290da3"},"shouldIndex":true,"org":{"createdAt":"2024-01-20T00:51:05.035Z"},"cssFiles":[],"jsFiles":[],"mdxSourceWithNoJs":{"compiledSource":"\"use strict\";\nconst {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n a: \"a\",\n code: \"code\",\n p: \"p\",\n pre: \"pre\",\n span: \"span\",\n ..._provideComponents(),\n ...props.components\n }, {CodeBlock, Frame, Heading, Note, ZoomImage} = _components;\n if (!CodeBlock) _missingMdxReference(\"CodeBlock\", true);\n if (!Frame) _missingMdxReference(\"Frame\", true);\n if (!Heading) _missingMdxReference(\"Heading\", true);\n if (!Note) _missingMdxReference(\"Note\", true);\n if (!ZoomImage) _missingMdxReference(\"ZoomImage\", true);\n return _jsxs(_Fragment, {\n children: [_jsx(_components.p, {\n children: \"Uploading static sources as training data for your AI Agents is well and good, but what if your database is huge, structured, externally-hosted,\\nor updated in real-time? There is no way to dump the entire database into GPT-trainer’s static knowledge library and still maintain a live link…\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"This is where function-calling comes in. Through function-calling, you can serve data on-demand to your AI Agent in GPT-trainer during a live\\nconversation session. To show you how, we walk you through an example of RAG enrichment using (abstracts of) academic papers sourced from a trusted\\nacademic papers aggregator: Semantic Scholar API.\"\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"setting-up-and-testing-the-function\",\n children: \"Setting up and testing the function\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"First, you’ll need an API key from your external data provider, whoever that may be, assuming they have a secure API. In our case, we requested one\\nfrom \", _jsx(_components.a, {\n href: \"https://www.semanticscholar.org/\",\n children: \"Semantic Scholar\"\n }), \" directly.\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"Since we want to enrich our LLM query response with relevant information from academic research, we need to find the appropriate API endpoint to\\nconduct the search. Semantic Scholar offers nice \", _jsx(_components.a, {\n href: \"https://api.semanticscholar.org/api-docs/graph#tag/Paper-Data/operation/get_graph_paper_relevance_search\",\n children: \"documentation\"\n }), \"\\nin that regard.\"]\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-1.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"So what does this API endpoint respond with?\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"To inspect the output, we ran a script that makes a request to the API based on hardcoded input parameters. The source code of our script is included\\nbelow. You will need your own Semantic Scholar API key if you wish to run it yourself. For our example, we ran a search for relevant papers on the topic\\nof “Multifidelity Optimization” and “Gaussian Processes”.\"\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-python\",\n children: _jsxs(_components.code, {\n className: \"language-python\",\n children: [_jsxs(_components.span, {\n className: \"\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" requests\"]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" json\"]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" os\"]\n }), \"\\n\", \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Set up the headers with the API key\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\"headers \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"'X-API-KEY'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"YOUR OWN API KEY\\\"\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })\n }), \"\\n\", \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Specify the fields you want to fetch for each recommended paper\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\"fields \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"paperId,title,authors,abstract,url,referenceCount\\\"\"\n })]\n }), \"\\n\", \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Define the limit for the number of recommendations to return\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\"limit \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"20\"\n })]\n }), \"\\n\", \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Make the request to get paper recommendations\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\"response \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" requests\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"get\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"'https://api.semanticscholar.org/graph/v1/paper/search'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" headers\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \"headers\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token comment\",\n children: \"# json=payload,\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" params\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'fields'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \" fields\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"'limit'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \" limit\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"'query'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'multifidelity optimization, gaussian processes'\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n })\n }), \"\\n\", \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Check if the request was successful\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"if\"\n }), \" response\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"status_code \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"==\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"200\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"print\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"json\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"dumps\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"response\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"json\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" indent\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token number\",\n children: \"2\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"else\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"print\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsxs(_components.span, {\n className: \"token string-interpolation\",\n children: [_jsx(_components.span, {\n className: \"token string\",\n children: \"f\\\"Error: \"\n }), _jsxs(_components.span, {\n className: \"token interpolation\",\n children: [_jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n }), \"response\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"status_code\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"\"\n })]\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token comment\",\n children: \"# It's better to print response.text for non-200 responses, as they may not be in JSON format\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"print\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"response\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"text\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n })]\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"The output we received looks like follows:\"\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-json\",\n children: _jsxs(_components.code, {\n className: \"language-json\",\n children: [_jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"total\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"12096\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"offset\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"0\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"next\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"20\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"data\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"paperId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"b108e6e11f4a96d5058945f3b582a032e8204ade\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"url\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"https://www.semanticscholar.org/paper/b108e6e11f4a96d5058945f3b582a032e8204ade\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"title\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Multifidelity Gaussian processes for failure boundary andprobability estimation\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"abstract\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Estimating probability of failure in aerospace systems is a critical requirement for flight certification and qualification. Failure probability estimation (FPE) involves resolving tails of probability distribution and Monte Carlo (MC) sampling methods are intractable when expensive high-fidelity simulations have to be queried. We propose a method to use models of multiple fidelities, which trade accuracy for computational efficiency. Specifically, we propose the use of multifidelity Gaussian process models to efficiently fuse models at multiple fidelity. Furthermore, we propose a novel acquisition function within a Bayesian optimization framework, which can sequentially select samples (or batches of samples for parallel evaluation) from appropriate fidelity models to make predictions about quantities of interest in the highest fidelity. We use our proposed approach within a multifidelity importance sampling (MFIS) setting, and demonstrate our method on the failure level set estimation on synthetic test functions as well as the transonic flow past an airfoil wing section.\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"referenceCount\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"49\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authors\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"98543101\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Ashwin Renganathan\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"144321616\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Vishwas Rao\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"143672238\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Ionel M. Navon\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"paperId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"963a5c60ada159d27641a284008f57d6419b26f2\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"url\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"https://www.semanticscholar.org/paper/963a5c60ada159d27641a284008f57d6419b26f2\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"title\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Generative Transfer Optimization for Aerodynamic Design\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"abstract\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Transfer optimization, one type of optimization methods, which leverages knowledge of the completed tasks to accelerate the design progress of a new task, has been in widespread use in machine learning community. However, when applying transfer optimization to accelerate the progress of aerodynamic shape optimization (ASO), two challenges are encountered in sequence, that is, (1) how to build a shared design space among the related aerodynamic design tasks, and (2) how to exchange information between tasks most efficiently. To address the first challenge, a datadriven generative model is used to learn airfoil representations from the existing database, with the aim of synthesizing various airfoil shapes in a shared design space. To address the second challenge, both singleand multifidelity Gaussian processes (GPs) are employed to carry out optimization. On one hand, the multifidelity GP is used to leverage knowledge from the completed tasks. On the other hand, mutual learning is established between singleand multifidelity GP models by exchanging information between them in each optimization cycle. With the above, a generative transfer optimization (GTO) framework is proposed to shorten the design cycle of aerodynamic design. Through airfoil optimizations at different working conditions, the effectiveness of the proposed GTO framework is demonstrated.\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"referenceCount\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"16\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authors\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"2149505113\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Zhendong Guo\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"2153199285\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Wei Sun\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"50258957\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Liming Song\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"46276037\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Jun Yu Li\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"authorId\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"73325644\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Z. Feng\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"… (truncated due to length)\"\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"The Semantic Scholar function returned the top 20 matching results ranked by relevance based on our input parameter specification. As you see, the response\\ncan get quite long, so we truncated the output for conciseness.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Ideally, you want a structured JSON response from the function’s output like what we showed above.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"We ran our own analysis for this particular API endpoint (with the specific set of output fields we requested) and found that on average, each returned\\nresult is between 400-500 tokens long. This means that depending on the token limit we reserved for the function output, we can only fit so many search results\\nin before running out of space. Keep this in mind as you prioritize the information you wish to supply to the LLM during RAG.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Now we know what the LLM would see as additional context provided by the function call, we can start linking it to our GPT-trainer Agent.\"\n }), \"\\n\", _jsx(Note, {\n children: _jsx(_components.p, {\n children: \"It is ALWAYS advisable to write your own script and test for the output of the API endpoint first. You want to know exactly what kind information\\nis being fed into your AI Agent.\"\n })\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"create-and-prepare-the-ai-agent\",\n children: \"Create and prepare the AI Agent\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"In your chatbot inside GPT-trainer, you must first create an appropriate AI Agent that you plan to give this function-calling capability to. In our example,\\nwe created “The Professor”. We then defined an associated Agent description and base prompt.\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-2.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"We picked the GPT-4-0125-8k Model for this example. You can see our simple prompt in the screenshot below.\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-3.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"Next, we save the Agent and go to the “Knowledge” tab to disable static RAG from the chatbot’s own knowledge library. This is only necessary if you don’t want\\nto use any training data from the static sources list. In our example, we didn’t upload any training data anyways, but we do this as standard practice to keep\\nthings clean.\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-4.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"Save the Agent.\"\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"function-setup\",\n children: \"Function setup\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Within your Agent, head over to the “Functions” tab. Change the “Response Context Limit” to the maximum allowed. Then click “Add function”.\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-5.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"This is where you tell the LLM exactly what the function does and how it works. The LLM will then decide on its own whether it needs the function when responding\\nto the user during a conversation, then call it with the appropriate parameters as needed.\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-6.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"The function name and description are particularly useful in helping the AI understand what the function does. Please make sure to be as explicit as possible in\\nyour own definition. The function description must be less than 1024 characters, including spaces. In our case, we wrote the following:\"\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-plaintext\",\n children: _jsxs(_components.code, {\n children: [_jsx(_components.span, {\n className: \"\",\n children: \"Function name: paper_relevance_search\"\n }), \"\\n\", \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"Function description: \"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"This function searches Semantic Scholar, a scholarly literature database. The input parameters will be defined based on extracted information from conversation context. It will return search results containing academic paper metadata (with abstracts) in a JSON format.\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"The returned fields are defined as follows:\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- title: paper title\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- abstract: paper abstract\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- paperId: paper uuid\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- authors: paper authors\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- year: paper publication year\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- url: paper link\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- referenceCount: number of references included in the paper\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: \"- citationCount: number of citations of this paper\"\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"Next, define the API endpoint. The Semantic Scholar endpoint we are using is simple and straighforward:\"\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-plaintext\",\n children: _jsxs(_components.code, {\n children: [_jsx(_components.span, {\n className: \"\",\n children: \"https://api.semanticscholar.org/graph/v1/paper/search\"\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"After that, choose the HTTP method. We use “GET” for our example. The specific API endpoint you are using should have documentation about this distinction.\"\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"fixed-parameters\",\n children: \"Fixed parameters\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Static (Fixed) Parameters remain constant across all API requests. They are pre-defined and reflect settings or configurations that do not change with each\\ncall. For example, parameters that specify the format of the response or that enable/disable certain features globally across all API interactions fall into\\nthis category. The term “static” emphasizes their unchanging nature.\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"Depending on your particular API endpoint, you may need to append some fixed parameters in the URL. The API we use above from Semantic Scholar does not require\\nfixed parameters. But if you are using a more complex endpoint like this:\\n\", _jsx(_components.a, {\n href: \"https://app.outscraper.com/api-docs#tag/Businesses-and-POI/paths/~1maps~1search-v3/get\",\n children: \"https://app.outscraper.com/api-docs#tag/Businesses-and-POI/paths/~1maps~1search-v3/get\"\n }), \", then your API endpoint may include fixed parameters and look something like:\"]\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-plaintext\",\n children: _jsxs(_components.code, {\n children: [_jsx(_components.span, {\n className: \"\",\n children: \"https://api.app.outscraper.com/maps/search-v3?async=false\u0026fields=name,full_address,phone,site\"\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"Notice that at the end of “\", _jsx(_components.a, {\n href: \"https://api.app.outscraper.com/maps/search-v3\",\n children: \"https://api.app.outscraper.com/maps/search-v3\"\n }), \"”, we get into fixed parameters. This is where you define parameters that will not change\\nwhen the function is called. Always define fixed parameters this way!\"]\n }), \"\\n\", _jsx(Note, {\n children: _jsx(_components.p, {\n children: \"If your API is capable of returning a more concise response by configuring certain parameters (i.e., tell the API to leave out unnecessary metadata in the response),\\nthen we highly suggest that you do so. It will reduce token waste and help AI understand the context better. In the above example, we set “fields=name,full_address,phone,site”\\nspecifically to limit the response so that it contains only name, full_address, phone, and site information - and nothing else.\"\n })\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"headers-and-authentication\",\n children: \"Headers and Authentication\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"In general, secure public-facing APIs require authentication. Semantic Scholar is the same. In the Header, we provide our API key. The specific key field used\\nto supply your authentication token will differ based on the particular API you use, so please make sure to be informed on your API provider’s documentation.\\nFor our example, the key field is named “x-api-key”:\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-7.png\"\n })\n })\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"variable-parameters\",\n children: \"Variable parameters\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Finally, we get to variable parameters.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Variable (Dynamic) Parameters dynamically change based on user input or conversation context, unlike their static counterparts. In function calling, these parameters\\nadapt to the specifics of each request, being determined at runtime. This ensures that API calls made by the AI are tailored to the immediate needs of the conversation,\\nenabling a more personalized and relevant interaction. The AI extracts these parameters directly from the dialogue, determining when and how to call the function\\nbased on the ongoing conversation.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"For our function, we define the following variable parameters:\"\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-json\",\n children: _jsxs(_components.code, {\n className: \"language-json\",\n children: [_jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"object\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"properties\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"query\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"string\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"description\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"The keywords, author names or exact paper IDs to search for\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"fields\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"string\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"description\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"The information to be returned, default as 'title,abstract,paperId,authors,year,url,referenceCount,citationCount'\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"limit\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"string\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"description\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"The number of papers users want to get, default as 2. Use the default for all cases.\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"required\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"query\\\"\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })\n }), \"\\n\", \"\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"Notice that this is a structured JSON format. Under the key field “type” of the entire parameter-set, we put “object”. You should do the same for yours.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Under properties, you define each parameter along with their type and description. Take “query” for example. It has type String, meaning its data type is free text.\\nTypes can be “String”, “integer”, “boolean”, “array”, etc. The description is more open-ended, but also extremely important. This is where you must tell\\nthe LLM what this parameter represents. To the best of your ability, provide default values and examples of actual parameter values when the function is called.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Try to be as explicit as possible. Remember that if the AI has to guess whether a parameter named ‘language’ should take ‘en’ or ‘english’ as input, chances are\\nit will guess wrong, and you will see errors in your chatbot output.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Depending on the function you are working with, input parameters can get pretty complex. Below is another example for supplying parameters to a function (NOT related\\nto our Semantic Scholar example) that uses an array:\"\n }), \"\\n\", _jsx(CodeBlock, {\n filename: \"\",\n expandable: \"false\",\n children: _jsx(_components.pre, {\n className: \"language-json\",\n children: _jsxs(_components.code, {\n className: \"language-json\",\n children: [_jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"object\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"properties\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"tags\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"array\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"description\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"labels that should be assigned to the user’s request\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"items\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"object\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"properties\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"string\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"description\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"The name of the label\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"color\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"type\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"string\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"description\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"The color of the label\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"required\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"name\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"color\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"\",\n children: [\" \", _jsx(_components.span, {\n className: \"token property\",\n children: \"\\\"required\\\"\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"tags\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"\",\n children: _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"The function can only be called once the “required” parameters have been collected. If necessary information is missing, the function cannot be invoked. You\\nmust define which parameters are mandatory in order for the function to be called.\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"For additional information on the supported JSON schema, please reference this guide: \", _jsx(_components.a, {\n href: \"https://json-schema.org/understanding-json-schema/reference/type\",\n children: \"https://json-schema.org/understanding-json-schema/reference/type\"\n })]\n }), \"\\n\", _jsx(Heading, {\n level: \"2\",\n id: \"testing-the-chatbot\",\n children: \"Testing the chatbot\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Once everything is set up, save your function, then save the Agent. You can then test it out under “Preview” tab:\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-8.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"You can turn on the debug mode with the toggle on the top right corner of the screen. This will allow you to inspect the output of the function if it had been\\ncalled during the LLM response:\"\n }), \"\\n\", _jsx(Frame, {\n children: _jsx(ZoomImage, {\n children: _jsx(\"img\", {\n src: \"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/images/fc-external-database-api-9.png\"\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"Just like that, you equipped your AI Agent with on-demand information from an external data provider. In the future, we will also write a guide that helps you\\nimplement and host your own database search function that then gets integrated with GPT-trainer.\"\n })]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\nfunction _missingMdxReference(id, component) {\n throw new Error(\"Expected \" + (component ? \"component\" : \"object\") + \" `\" + id + \"` to be defined: you likely forgot to import, pass, or provide it.\");\n}\n","frontmatter":{},"scope":{"mintConfig":{"$schema":"https://mintlify.com/schema.json","name":"GPT-trainer API","logo":{"light":"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/logo/light.svg","dark":"https://mintlify.s3.us-west-1.amazonaws.com/paladinmaxinc/logo/dark.svg"},"favicon":"/logo/favicon.png","api":{"baseUrl":"https://app.gpt-trainer.com/api","auth":{"method":"bearer"}},"colors":{"primary":"#2E3F51","light":"#516F90","dark":"#0D001D","background":{"dark":"#111827"},"anchors":{"from":"#ED727B","to":"#F6B7BB"}},"topbarLinks":[{"url":"mailto:hello@gpt-trainer.com","name":"Support","_id":"676a0adaff1411a490c729a2"}],"navigation":[{"group":"Getting Started","pages":["introduction"]},{"group":"Guides","pages":["creating-first-chatbot","lead-collection","human-support-escalation","inbox-notifications","conversation-labeling","multi-agents-chatbot","fine-tuning-agent-intents","supervisor-overrides","byok-pricing-guide","working-with-tables","best-practices","help"]},{"group":"Function Calling","pages":["rag-from-external-data-provider"]},{"group":"API Usage Guides","pages":["api-reference/api-key-setup","api-reference/guide-00-chatbot-create","api-reference/guide-01-chat","api-reference/guide-02-source"]},{"group":"Authentication Webhook","pages":["user-identity"]},{"group":"Chatbots","pages":["api-reference/chatbots/properties-reference","api-reference/chatbots/create","api-reference/chatbots/update","api-reference/chatbots/fetch","api-reference/chatbots/fetch_multi","api-reference/chatbots/delete"]},{"group":"Agents","pages":["api-reference/agents/properties-reference","api-reference/agents/create","api-reference/agents/update","api-reference/agents/fetch_multi","api-reference/agents/delete"]},{"group":"Chatbot Sessions","pages":["api-reference/sessions/properties-reference","api-reference/sessions/create","api-reference/sessions/fetch","api-reference/sessions/fetch_multi","api-reference/sessions/delete","api-reference/sessions/delete_multi"]},{"group":"Session Messages","pages":["api-reference/messages/properties-reference","api-reference/messages/create","api-reference/messages/fetch_multi","api-reference/messages/delete","api-reference/messages/delete_multi"]},{"group":"Data Sources","pages":["api-reference/data-sources/properties-reference","api-reference/data-sources/create-file","api-reference/data-sources/create-qa","api-reference/data-sources/create-url","api-reference/data-sources/update","api-reference/data-sources/fetch_multi","api-reference/data-sources/retrain","api-reference/data-sources/delete","api-reference/data-sources/delete_multi"]},{"group":"Data Source Tags","pages":["api-reference/source-tags/create","api-reference/source-tags/fetch-multi","api-reference/source-tags/update","api-reference/source-tags/delete"]},{"group":"Tool Guides","pages":["tools/tools-intro"]},{"group":"Tools","pages":["tools/weekday"]},{"group":"Whitelabel Dashboard","pages":["whitelabel/whitelabel-intro","whitelabel/whitelabel-plans","whitelabel/whitelabel-users"]},{"group":"Integrations","pages":["whitelabel/whitelabel-zapier","whitelabel/whitelabel-make","whitelabel/whitelabel-meta"]}],"primaryTab":{"name":"Documentation"},"anchors":[{"name":"API References","url":"api-reference","icon":"code","_id":"676a0adaff1411a490c7299f"},{"name":"Tools","url":"tools","icon":"gear","_id":"676a0adaff1411a490c729a0"},{"name":"Whitelabel","url":"whitelabel","icon":"browser","_id":"676a0adaff1411a490c729a1"}],"repo":{"github":{"owner":"ks-collab","repo":"gpt-trainer-docs","contentDirectory":"","deployBranch":"main","isPrivate":false}}},"pageMetadata":{"title":"RAG from an External Data Provider","description":null,"href":"/rag-from-external-data-provider"}}}},"__N_SSG":true},"page":"/_sites/[subdomain]/[[...slug]]","query":{"subdomain":"guide.gpt-trainer.com","slug":["rag-from-external-data-provider"]},"buildId":"pChs_9tFT1YAEINLWWPhQ","isFallback":false,"isExperimentalCompile":false,"gsp":true,"scriptLoader":[]}</script>
<!-- Mirrored from guide.gpt-trainer.com/rag-from-external-data-provider by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 07 Jan 2025 14:53:25 GMT -->
</html></body></html>