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…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.
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 Semantic Scholar directly.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 documentation
in that regard.
So what does this API endpoint respond with?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”.
import requestsimport jsonimport os# Set up the headers with the API keyheaders = { 'X-API-KEY': "YOUR OWN API KEY"}# Specify the fields you want to fetch for each recommended paperfields = "paperId,title,authors,abstract,url,referenceCount"# Define the limit for the number of recommendations to returnlimit = 20# Make the request to get paper recommendationsresponse = requests.get( 'https://api.semanticscholar.org/graph/v1/paper/search', headers=headers, # json=payload, params={'fields': fields, 'limit': limit, 'query':'multifidelity optimization, gaussian processes' })# Check if the request was successfulif response.status_code == 200: print(json.dumps(response.json(), indent=2))else: print(f"Error: {response.status_code}") # It's better to print response.text for non-200 responses, as they may not be in JSON format print(response.text)
The output we received looks like follows:
{ "total": 12096, "offset": 0, "next": 20, "data": [ { "paperId": "b108e6e11f4a96d5058945f3b582a032e8204ade", "url": "https://www.semanticscholar.org/paper/b108e6e11f4a96d5058945f3b582a032e8204ade", "title": "Multifidelity Gaussian processes for failure boundary andprobability estimation", "abstract": "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.", "referenceCount": 49, "authors": [ { "authorId": "98543101", "name": "Ashwin Renganathan" }, { "authorId": "144321616", "name": "Vishwas Rao" }, { "authorId": "143672238", "name": "Ionel M. Navon" } ] }, { "paperId": "963a5c60ada159d27641a284008f57d6419b26f2", "url": "https://www.semanticscholar.org/paper/963a5c60ada159d27641a284008f57d6419b26f2", "title": "Generative Transfer Optimization for Aerodynamic Design", "abstract": "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.", "referenceCount": 16, "authors": [ { "authorId": "2149505113", "name": "Zhendong Guo" }, { "authorId": "2153199285", "name": "Wei Sun" }, { "authorId": "50258957", "name": "Liming Song" }, { "authorId": "46276037", "name": "Jun Yu Li" }, { "authorId": "73325644", "name": "Z. Feng" } ] },… (truncated due to length)
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.Ideally, you want a structured JSON response from the function’s output like what we showed above.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.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.
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.
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.
We picked the GPT-4-0125-8k Model for this example. You can see our simple prompt in the screenshot below.
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.
Within your Agent, head over to the “Functions” tab. Change the “Response Context Limit” to the maximum allowed. Then click “Add function”.
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.
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:
Function name: paper_relevance_searchFunction description: 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.The returned fields are defined as follows:- title: paper title- abstract: paper abstract- paperId: paper uuid- authors: paper authors- year: paper publication year- url: paper link- referenceCount: number of references included in the paper- citationCount: number of citations of this paper
Next, define the API endpoint. The Semantic Scholar endpoint we are using is simple and straighforward:
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.
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.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:
https://app.outscraper.com/api-docs#tag/Businesses-and-POI/paths/~1maps~1search-v3/get, then your API endpoint may include fixed parameters and look something like:
Notice that at the end of “https://api.app.outscraper.com/maps/search-v3”, 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!
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.
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”:
Finally, we get to variable parameters.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.For our function, we define the following variable parameters:
{ "type": "object", "properties": { "query": { "type": "string", "description": "The keywords, author names or exact paper IDs to search for" }, "fields": { "type": "string", "description": "The information to be returned, default as 'title,abstract,paperId,authors,year,url,referenceCount,citationCount'" }, "limit": { "type": "string", "description": "The number of papers users want to get, default as 2. Use the default for all cases." } }, "required": [ "query" ]}
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.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.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.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:
{ "type": "object", "properties": { "tags": { "type": "array", "description": "labels that should be assigned to the user’s request", "items": { "type": "object", "properties": { "name": { "type": "string", "description": "The name of the label", }, "color": { "type": "string", "description": "The color of the label", }, }, "required": ["name", "color"], }, }, }, "required": ["tags"],}
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.For additional information on the supported JSON schema, please reference this guide: https://json-schema.org/understanding-json-schema/reference/type
Once everything is set up, save your function, then save the Agent. You can then test it out under “Preview” tab:
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:
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.
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"GPT-trainer API","colors":{"primary":"#2E3F51","light":"#516F90","dark":"#0D001D"},"favicon":"https://mintcdn.com/paladinmaxinc/_odr0HDBZYr--Le1/logo/favicon.png?fit=max\u0026auto=format\u0026n=_odr0HDBZYr--Le1\u0026q=85\u0026s=d04dff53c81245c4d48f0301bad6209f","logo":{"light":"https://mintcdn.com/paladinmaxinc/_odr0HDBZYr--Le1/logo/light.svg?fit=max\u0026auto=format\u0026n=_odr0HDBZYr--Le1\u0026q=85\u0026s=e282ced1ff19648529968cefe4eb3deb","dark":"https://mintcdn.com/paladinmaxinc/_odr0HDBZYr--Le1/logo/dark.svg?fit=max\u0026auto=format\u0026n=_odr0HDBZYr--Le1\u0026q=85\u0026s=bee6ec229dfdcd8e2a9654329a38a3c6"},"api":{"mdx":{"server":"https://app.gpt-trainer.com/api","auth":{"method":"bearer","name":null}}},"background":{"decoration":null,"color":{"light":null,"dark":"#111827"}},"navbar":{"links":[{"label":"Support","href":"mailto:hello@gpt-trainer.com"}],"primary":null},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"paladinmaxinc","hasAudioNarration":false,"actualSubdomain":"paladinmaxinc","customDomains":["guide.gpt-trainer.com"],"gitSource":{"type":"github","owner":"ks-collab","repo":"gpt-trainer-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a21e61733a4518725aab1a4","collectionId":"176b19f7-2d23-4aaa-b976-d711aa6932e6","schemaVersion":"v2"},"entitlements":{},"buildId":"6a21e61733a4518725aab1a4:success","clientVersion":"0.0.3965","searchFilterCounts":[{"language":"default","tag":"API References","count":39},{"language":"default","tag":"Documentation","count":15},{"language":"default","tag":"Guides","count":12},{"language":"default","tag":"Data Sources","count":9},{"language":"default","tag":"Chatbots","count":6},{"language":"default","tag":"Session Messages","count":6},{"language":"default","tag":"Whitelabel","count":6},{"language":"default","tag":"Agents","count":5},{"language":"default","tag":"Chatbot Sessions","count":5},{"language":"default","tag":"Integrations","count":5}]},"assistantConfig":{},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"rag-from-external-data-provider","slug":"/rag-from-external-data-provider","pageMetadata":{"title":"RAG from an External Data Provider","description":null,"href":"/rag-from-external-data-provider"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,Frame,Heading,Note,OptimizedImage}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{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`,_jsx(_components.p,{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`,_jsx(Heading,{level:`2`,id:`setting-up-and-testing-the-function`,children:`Setting up and testing the function`}),`\n`,_jsxs(_components.p,{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,{href:`https://www.semanticscholar.org/`,children:`Semantic Scholar`}),` directly.`]}),`\n`,_jsxs(_components.p,{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,{href:`https://api.semanticscholar.org/api-docs/graph#tag/Paper-Data/operation/get_graph_paper_relevance_search`,children:`documentation`}),`\nin that regard.`]}),`\n`,_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-1.png?fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=5050799917cc47fc74b72c67fa1b9597`,\"data-og-width\":`1242`,width:`1242`,\"data-og-height\":`954`,height:`954`,\"data-path\":`images/fc-external-database-api-1.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-1.png?w=280\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=5b4666381689ca9b5af4719fcde1cef5 280w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-1.png?w=560\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=7ec014cbab6c429d4f3287cabf548834 560w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-1.png?w=840\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=c9577a035fdf70a6da06add779145d50 840w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-1.png?w=1100\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=280147e05bc35394a3ea37c96981b031 1100w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-1.png?w=1650\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=11b781ebc8eb472ad8d489c8c5fc65e7 1650w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-1.png?w=2500\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=1646769e97eb2c3c4dba786f7c7f39e1 2500w`})}),`\n`,_jsx(_components.p,{children:`So what does this API endpoint respond with?`}),`\n`,_jsx(_components.p,{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`,_jsx(CodeBlock,{filename:``,numberOfLines:`30`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`30`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Set up the headers with the API key`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`headers `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'X-API-KEY'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"YOUR OWN API KEY\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Specify the fields you want to fetch for each recommended paper`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`fields `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"paperId,title,authors,abstract,url,referenceCount\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Define the limit for the number of recommendations to return`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`limit `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 20`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Make the request to get paper recommendations`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.get(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://api.semanticscholar.org/graph/v1/paper/search'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`headers,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # json=payload,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` params`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'fields'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: fields, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'limit'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: limit, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'query'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'multifidelity optimization, gaussian processes'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Check if the request was successful`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.status_code `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`==`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 200`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(json.dumps(response.json(), `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`indent`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`else`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Error: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response.status_code`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # It's better to print response.text for non-200 responses, as they may not be in JSON format`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(response.text)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The output we received looks like follows:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`56`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`56`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"total\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`12096`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"offset\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"next\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`20`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"paperId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"b108e6e11f4a96d5058945f3b582a032e8204ade\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://www.semanticscholar.org/paper/b108e6e11f4a96d5058945f3b582a032e8204ade\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"title\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Multifidelity Gaussian processes for failure boundary andprobability estimation\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"abstract\": \"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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"referenceCount\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`49`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"authors\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"authorId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"98543101\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Ashwin Renganathan\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"authorId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"144321616\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Vishwas Rao\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"authorId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"143672238\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Ionel M. Navon\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"paperId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"963a5c60ada159d27641a284008f57d6419b26f2\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://www.semanticscholar.org/paper/963a5c60ada159d27641a284008f57d6419b26f2\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"title\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Generative Transfer Optimization for Aerodynamic Design\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"abstract\": \"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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"referenceCount\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`16`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"authors\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"authorId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"2149505113\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Zhendong Guo\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"authorId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"2153199285\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Wei Sun\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"authorId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"50258957\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Liming Song\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"authorId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"46276037\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Jun Yu Li\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"authorId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"73325644\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Z. Feng\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`…`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` (truncated`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` due`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` to`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` length)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{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`,_jsx(_components.p,{children:`Ideally, you want a structured JSON response from the function’s output like what we showed above.`}),`\n`,_jsx(_components.p,{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`,_jsx(_components.p,{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`,_jsx(Note,{children:_jsx(_components.p,{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`,_jsx(Heading,{level:`2`,id:`create-and-prepare-the-ai-agent`,children:`Create and prepare the AI Agent`}),`\n`,_jsx(_components.p,{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`,_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-2.png?fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=6131829460bc1d8fc5623a7428f7431a`,\"data-og-width\":`1096`,width:`1096`,\"data-og-height\":`947`,height:`947`,\"data-path\":`images/fc-external-database-api-2.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-2.png?w=280\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=ab350802ee5f84706e263666b8a9f805 280w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-2.png?w=560\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=f62ce6ed2a6168320ded4f938e22d322 560w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-2.png?w=840\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=e3bc505221ce18a62cc4f2b7010c2948 840w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-2.png?w=1100\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=c01f5c8792768c09f878e2c164ce6493 1100w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-2.png?w=1650\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=6ca4db1a5899b545342834c02f0a9536 1650w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-2.png?w=2500\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=2ec83117053d9c9dabd469c52cccff29 2500w`})}),`\n`,_jsx(_components.p,{children:`We picked the GPT-4-0125-8k Model for this example. You can see our simple prompt in the screenshot below.`}),`\n`,_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-3.png?fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=a6e30a912b55580ac5c4cd36e5c53c47`,\"data-og-width\":`1095`,width:`1095`,\"data-og-height\":`946`,height:`946`,\"data-path\":`images/fc-external-database-api-3.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-3.png?w=280\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=735de0024c6c5fb5ebda2826b6fca526 280w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-3.png?w=560\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=7756463d3178191c491f8ca6481befc0 560w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-3.png?w=840\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=225f89ad3f3d1d7108ef2b671304d784 840w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-3.png?w=1100\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=f38e5a60801dd3f7b734991bb52a1df2 1100w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-3.png?w=1650\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=cc146c17592942490fcfcb803832a3b2 1650w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-3.png?w=2500\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=29bbc501abe4ab1c1876b90e2e589371 2500w`})}),`\n`,_jsx(_components.p,{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`,_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-4.png?fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=abff1ba1b85fa7cfeb46f28b69f92feb`,\"data-og-width\":`1096`,width:`1096`,\"data-og-height\":`846`,height:`846`,\"data-path\":`images/fc-external-database-api-4.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-4.png?w=280\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=9f9487604e64314ba5002bcd499d0d9a 280w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-4.png?w=560\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=1ddb81c06f414eed9112d8975ee412e8 560w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-4.png?w=840\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=9eff2bb1db40fd439831d38b5eb988d6 840w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-4.png?w=1100\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=85245c36e99a5250675c909dcd2db519 1100w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-4.png?w=1650\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=e1de0d4e61b33e663e5106b02d88707d 1650w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-4.png?w=2500\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=321b291d3ce1d9797d0af64b5ce9014e 2500w`})}),`\n`,_jsx(_components.p,{children:`Save the Agent.`}),`\n`,_jsx(Heading,{level:`2`,id:`function-setup`,children:`Function setup`}),`\n`,_jsx(_components.p,{children:`Within your Agent, head over to the “Functions” tab. Change the “Response Context Limit” to the maximum allowed. Then click “Add function”.`}),`\n`,_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-5.png?fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=02b47028cef57a4e95268581aa187312`,\"data-og-width\":`1098`,width:`1098`,\"data-og-height\":`497`,height:`497`,\"data-path\":`images/fc-external-database-api-5.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-5.png?w=280\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=12decf965a1bad0afb2708942950deae 280w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-5.png?w=560\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=8822d89cd62238d2fd39fa541a791216 560w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-5.png?w=840\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=fc2b13f4c29bd518889b85fc1dbcefeb 840w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-5.png?w=1100\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=5cd89cd61d298f6857f6459e24a2aefc 1100w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-5.png?w=1650\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=b794e8f02cdae2754ffd5656f86bfb0f 1650w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-5.png?w=2500\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=383c0791c8fe2d5b55dc5d17df1d564c 2500w`})}),`\n`,_jsx(_components.p,{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`,_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-6.png?fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=c0ebb0717f67fea014f68d151ba7a250`,\"data-og-width\":`1099`,width:`1099`,\"data-og-height\":`949`,height:`949`,\"data-path\":`images/fc-external-database-api-6.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-6.png?w=280\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=39e1cdd80ec03c774c7a9210896307f9 280w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-6.png?w=560\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=ec65c9d70227d5c6bf5dd7817b1bd513 560w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-6.png?w=840\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=4655026edeacfcc5a7c49830d1d99b25 840w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-6.png?w=1100\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=7b6e9dc332d323cb09f6b071d0aec8c8 1100w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-6.png?w=1650\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=d2e530754755750b9aee93de967106b0 1650w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-6.png?w=2500\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=aff1836a64f56edcf5a7518b7cb31ccc 2500w`})}),`\n`,_jsx(_components.p,{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`,_jsx(CodeBlock,{numberOfLines:`14`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`14`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Function name: paper_relevance_search`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Function description: `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{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`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`The returned fields are defined as follows:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- title: paper title`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- abstract: paper abstract`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- paperId: paper uuid`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- authors: paper authors`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- year: paper publication year`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- url: paper link`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- referenceCount: number of references included in the paper`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- citationCount: number of citations of this paper`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Next, define the API endpoint. The Semantic Scholar endpoint we are using is simple and straighforward:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`https://api.semanticscholar.org/graph/v1/paper/search`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{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`,_jsx(Heading,{level:`2`,id:`fixed-parameters`,children:`Fixed parameters`}),`\n`,_jsx(_components.p,{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`,_jsxs(_components.p,{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,{href:`https://app.outscraper.com/api-docs#tag/Businesses-and-POI/paths/~1maps~1search-v3/get`,children:`https://app.outscraper.com/api-docs#tag/Businesses-and-POI/paths/~1maps~1search-v3/get`}),`, then your API endpoint may include fixed parameters and look something like:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`https://api.app.outscraper.com/maps/search-v3?async=false\u0026fields=name,full_address,phone,site`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`Notice that at the end of “`,_jsx(_components.a,{href:`https://api.app.outscraper.com/maps/search-v3`,children:`https://api.app.outscraper.com/maps/search-v3`}),`”, 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`,_jsx(Note,{children:_jsx(_components.p,{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`,_jsx(Heading,{level:`2`,id:`headers-and-authentication`,children:`Headers and Authentication`}),`\n`,_jsx(_components.p,{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`,_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-7.png?fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=49372954e3525ecd0edff13168808b82`,\"data-og-width\":`1099`,width:`1099`,\"data-og-height\":`946`,height:`946`,\"data-path\":`images/fc-external-database-api-7.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-7.png?w=280\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=4e492f899f4d14d6ea8c805bc35a0572 280w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-7.png?w=560\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=69e594c87885f9bbd7e22dfa650e52c5 560w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-7.png?w=840\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=4838e4567db81ba918bd71bb0c0b8d0e 840w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-7.png?w=1100\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=05c1d5547c5412308774b4f2927af7f9 1100w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-7.png?w=1650\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=39f8fe998bf5e458681c3d737f9d4bc0 1650w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-7.png?w=2500\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=dc4dfac8fb40e862374a8d41dbb5dedb 2500w`})}),`\n`,_jsx(Heading,{level:`2`,id:`variable-parameters`,children:`Variable parameters`}),`\n`,_jsx(_components.p,{children:`Finally, we get to variable parameters.`}),`\n`,_jsx(_components.p,{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`,_jsx(_components.p,{children:`For our function, we define the following variable parameters:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`21`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`21`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"query\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"The keywords, author names or exact paper IDs to search for\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"fields\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"The information to be returned, default as 'title,abstract,paperId,authors,year,url,referenceCount,citationCount'\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"limit\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"The number of papers users want to get, default as 2. Use the default for all cases.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"query\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})}),`\n`,_jsx(_components.p,{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`,_jsx(_components.p,{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`,_jsx(_components.p,{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`,_jsx(_components.p,{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`,_jsx(CodeBlock,{filename:``,numberOfLines:`24`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`24`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"tags\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"array\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"labels that should be assigned to the user’s request\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"items\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"The name of the label\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"color\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"The color of the label\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"color\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tags\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{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`,_jsxs(_components.p,{children:[`For additional information on the supported JSON schema, please reference this guide: `,_jsx(_components.a,{href:`https://json-schema.org/understanding-json-schema/reference/type`,children:`https://json-schema.org/understanding-json-schema/reference/type`})]}),`\n`,_jsx(Heading,{level:`2`,id:`testing-the-chatbot`,children:`Testing the chatbot`}),`\n`,_jsx(_components.p,{children:`Once everything is set up, save your function, then save the Agent. You can then test it out under “Preview” tab:`}),`\n`,_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-8.png?fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=a7ec81dfd91181dbffdc072196a64540`,\"data-og-width\":`657`,width:`657`,\"data-og-height\":`811`,height:`811`,\"data-path\":`images/fc-external-database-api-8.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-8.png?w=280\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=2ace362a5ad45a08b523e2db0e888bea 280w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-8.png?w=560\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=54880b7aaf4438e9e700e09db0ae8c13 560w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-8.png?w=840\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=6444e87105a18d1bf43ad5e2a1194f04 840w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-8.png?w=1100\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=9e48a8332b6ab4f38d98341df689e12b 1100w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-8.png?w=1650\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=f733e66a3e00076f5a5291d9dd1eb2f8 1650w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-8.png?w=2500\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=67a41ea1e888315c7d93c1a92baf8276 2500w`})}),`\n`,_jsx(_components.p,{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`,_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-9.png?fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=49b06fc40e44645b3ea3331542b23b6a`,\"data-og-width\":`1209`,width:`1209`,\"data-og-height\":`669`,height:`669`,\"data-path\":`images/fc-external-database-api-9.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-9.png?w=280\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=d7ae56bd5edd0e092f32a0215c1b084d 280w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-9.png?w=560\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=1c2bc26ba176fe39ab050c9be07f7ec5 560w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-9.png?w=840\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=ed112945ecb10b27fb13ef392bbdf9f3 840w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-9.png?w=1100\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=0a304eff781b34a76e0e00e07595fcdc 1100w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-9.png?w=1650\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=cf70ff95035545724629b65e9665f1fe 1650w, https://mintcdn.com/paladinmaxinc/eQPaNa5Mj6mg9P8v/images/fc-external-database-api-9.png?w=2500\u0026fit=max\u0026auto=format\u0026n=eQPaNa5Mj6mg9P8v\u0026q=85\u0026s=452caeff080801ff750ea42688082c80 2500w`})}),`\n`,_jsx(_components.p,{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.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"RAG from an External Data Provider","description":null,"href":"/rag-from-external-data-provider"}}},"mdxSourceWithNoJs":null},"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":{}},"jsLinks":[],"subdomain":"paladinmaxinc","siteName":"GPT-trainer API","title":"RAG from an External Data Provider - GPT-trainer API","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-01-07T00:48:27.794Z","originalFileLocation":"rag-from-external-data-provider.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"GPT-trainer API\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/paladinmaxinc/rZh3k9QVucZqPJ9E/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/paladinmaxinc/rZh3k9QVucZqPJ9E/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/paladinmaxinc/rZh3k9QVucZqPJ9E/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/paladinmaxinc/rZh3k9QVucZqPJ9E/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/paladinmaxinc/rZh3k9QVucZqPJ9E/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/paladinmaxinc/rZh3k9QVucZqPJ9E/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/paladinmaxinc/rZh3k9QVucZqPJ9E/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/paladinmaxinc/rZh3k9QVucZqPJ9E/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/paladinmaxinc/rZh3k9QVucZqPJ9E/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"RAG from an External Data Provider - GPT-trainer API\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"GPT-trainer API\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://guide.gpt-trainer.com/rag-from-external-data-provider\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://paladinmaxinc.mintlify.app/_mintlify/api/og/v2?division=Function+Calling\u0026amp;title=RAG+from+an+External+Data+Provider\u0026amp;theme=d354e6b8b2605c4dee81eb93\u0026amp;signature=b9bb4686128dab27a1775164ef681c29244668cf5c9390abc9cfadc195ff6db7\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"RAG from an External Data Provider - GPT-trainer API\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://paladinmaxinc.mintlify.app/_mintlify/api/og/v2?division=Function+Calling\u0026amp;title=RAG+from+an+External+Data+Provider\u0026amp;theme=d354e6b8b2605c4dee81eb93\u0026amp;signature=b9bb4686128dab27a1775164ef681c29244668cf5c9390abc9cfadc195ff6db7\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/paladinmaxinc/rZh3k9QVucZqPJ9E/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"GPT-trainer API\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#2E3F51\">\u003clink data-mint-head rel=\"canonical\" href=\"https://guide.gpt-trainer.com/rag-from-external-data-provider\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/rag-from-external-data-provider.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://guide.gpt-trainer.com/#organization\",\"name\":\"GPT-trainer API\",\"url\":\"https://guide.gpt-trainer.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/paladinmaxinc/_odr0HDBZYr--Le1/logo/light.svg?fit=max\u0026auto=format\u0026n=_odr0HDBZYr--Le1\u0026q=85\u0026s=e282ced1ff19648529968cefe4eb3deb\"}},{\"@type\":\"WebSite\",\"@id\":\"https://guide.gpt-trainer.com#website\",\"name\":\"GPT-trainer API\",\"url\":\"https://guide.gpt-trainer.com\",\"publisher\":{\"@id\":\"https://guide.gpt-trainer.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://guide.gpt-trainer.com/rag-from-external-data-provider#webpage\",\"url\":\"https://guide.gpt-trainer.com/rag-from-external-data-provider\",\"name\":\"RAG from an External Data Provider\",\"dateModified\":\"2026-01-07T00:48:27.794Z\",\"isPartOf\":{\"@id\":\"https://guide.gpt-trainer.com#website\"},\"breadcrumb\":{\"@id\":\"https://guide.gpt-trainer.com/rag-from-external-data-provider#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://guide.gpt-trainer.com/rag-from-external-data-provider#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"GPT-trainer API\",\"item\":\"https://guide.gpt-trainer.com\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"RAG from an External Data Provider\",\"item\":\"https://guide.gpt-trainer.com/rag-from-external-data-provider\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://guide.gpt-trainer.com/rag-from-external-data-provider#article\",\"headline\":\"RAG from an External Data Provider\",\"name\":\"RAG from an External Data Provider\",\"url\":\"https://guide.gpt-trainer.com/rag-from-external-data-provider\",\"mainEntityOfPage\":{\"@id\":\"https://guide.gpt-trainer.com/rag-from-external-data-provider#webpage\"},\"dateModified\":\"2026-01-07T00:48:27.794Z\",\"publisher\":{\"@id\":\"https://guide.gpt-trainer.com/#organization\"},\"isPartOf\":{\"@id\":\"https://guide.gpt-trainer.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"GPT-trainer API\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"GPT-trainer API","nav":{"global":null,"anchors":[{"anchor":"Documentation","icon":"book-open","groups":[{"group":"Getting Started","pages":[{"title":"Introduction","href":"/introduction"}]},{"group":"Guides","pages":[{"title":"Create Your First Chatbot","href":"/creating-first-chatbot"},{"title":"Lead Collection","href":"/lead-collection"},{"title":"Human Support Escalation","href":"/human-support-escalation"},{"title":"Inbox Notifications","href":"/inbox-notifications"},{"title":"Conversation Labeling","href":"/conversation-labeling"},{"title":"Multi-Agents Chatbot","href":"/multi-agents-chatbot"},{"title":"Fine Tuning Agent Intents","href":"/fine-tuning-agent-intents"},{"title":"AI Supervisor Overrides","href":"/supervisor-overrides"},{"title":"Bring Your Own Key (BYOK) and Pricing","href":"/byok-pricing-guide"},{"title":"Working with Tables and CSV","href":"/working-with-tables"},{"title":"Best practices for preparing training data","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","href":"/rag-from-external-data-provider"}]},{"group":"Authentication Webhook","pages":[{"title":"User Identity Verification","description":null,"href":"/user-identity"}]}]},{"anchor":"API References","icon":"code","pages":[{"title":"API References","href":"/api-reference/api-key-setup"}]},{"anchor":"Integrations","icon":"network-wired","pages":[{"title":"Integrations","href":"/integrations/slack"}]},{"anchor":"Tools","icon":"gear","pages":[{"title":"Tools","href":"/tools/tools-intro"}]},{"anchor":"Whitelabel","icon":"browser","pages":[{"title":"Whitelabel","href":"/whitelabel/whitelabel-intro"}]}]},"title":"RAG from an External Data Provider - GPT-trainer API","buildId":"dpl_849ArpqvBiCczQiT1Y1stNGpbqHT","deploymentId":"dpl_849ArpqvBiCczQiT1Y1stNGpbqHT","dynamics":["07c022d89b","a74be98ba7"],"chunks":["Frame-Cz91mEGH.js","DynamicMarkdown-a8hUKrw6.js","zoom-image-lightbox-CaUwvYH3.js","lightbox-handle-r17bVUz3.js"]}