# US 2025/0384064 A1 · Function calling to enable muti-source data retrieval in generative artificial intelligence systems

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2025/0384064 A1
- Document ID: US20250384064A1
- Status: Published application
- Kind: A1
- Application number: 18/743,552
- Filed: 2024-06-14
- Published: 2025-12-18
- Earliest claimed: 2024-06-14
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC
- Inventors: Atabak ASHFAQ; Satarupa GUHA; Haiyuan CAO; Yu HU
- Web page: https://patentgrep.com/patent/US20250384064A1

## CPC

- G06F 16/3329: Natural language query formulation
- G06F 16/90332: {Natural language query formulation or dialogue systems}
- G06F 16/3325: {Reformulation based on results of preceding query}
- G06F 16/33295: {in dialogue systems}
- G06F 16/335: Filtering based on additional data, e.g. user or group profiles (filtering in web context G06F16/9535, G06F16/9536)
- G06F 16/345: {Summarisation for human users}
- G06F 16/383: using metadata automatically derived from the content
- G06F 16/9535: Search customisation based on user profiles and personalisation
- G06F 40/35: Discourse or dialogue representation
- G06N 3/045: Combinations of networks
- G06N 5/022: Knowledge engineering; Knowledge acquisition
- G06N 5/04: Inference or reasoning models
- G06N 5/041: {Abduction}
- G06N 20/00: Machine learning
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

A generative artificial intelligence system includes a retrieval augmented generation (RAG) assistant that utilizes function calling to facilitate multi-source data retrieval to enhance user queries transmitted to a large language model (LLM). The RAG assistant Transmits, to the LLM, a function selection instruction prompt that includes conversation history data, a function list including function definitions that each correspond to a data source, and instructions directing the LLM to return a function call to at least one function defined on the function list identified as relevant to the conversation history data based on a corresponding function descriptor. In response to receiving a function selection response from the LLM that includes the function call, the RAG assistant selects and executes a conditional operation based on a name of the at least one function.

## Claims

### Claim 1

A method comprising:
receiving, from a user compute system, conversation history data including a query;
generating, by a retrieval augmented generative (RAG) assistant, a function selection instruction prompt for a large language model (LLM), the function selection instruction prompt including:
the conversation history data;
a function list including function definitions that each correspond to a data source and include a function descriptor that describes content of the data source; and
instructions directing the LLM to return a function call to at least one function on the function list identified as relevant to the conversation history data based on the corresponding function descriptor; and
receiving, at the RAG assistant, a function selection response from the LLM including the function call;
based on the least one function identified within the function selection response, selecting a conditional operation from multiple defined conditional operations; and
executing, by the RAG assistant, the conditional operation.

### Claim 2 (depends on 1)

The method of claim 1, wherein the function list includes an out-of-domain function with a function descriptor that instructs the LLM to select the out-of-domain function in response to determining that no other function on the function list is relevant to the conversation history data.

### Claim 3 (depends on 2)

The method of claim 2, wherein the conditional operation includes:
transmitting a response to the user compute system in response to determining that the function selection response identifies the out-of-domain function, wherein the response indicates that the query could not be answered using available data sources.

### Claim 4 (depends on 3)

The method of claim 3, wherein the function selection instruction prompt further includes potentially-relevant data chunks mined from one or more data sources and the function list includes a particular function with a function descriptor that instructs the LLM to select the particular function in response to determining that the potentially-relevant data chunks are usable to answer the query.

### Claim 5 (depends on 1)

The method of claim 1, wherein the method further comprises:
receiving, from a user compute system, identification of a group of approved data sources, wherein each data source of the group of approved data sources corresponds to a function on the function list.

### Claim 6 (depends on 1)

The method of claim 1, further comprising:
determining that the function call identifies a function corresponding to a select data source;
retrieving, from the select data source, potentially-relevant data chunks satisfying similarity criteria with the conversation history data;
transmitting, to the LLM, a context-enhanced query that includes:
the query;
context data that includes the potentially-relevant data chunks; and
an instruction directing the LLM to answer the context-enhanced query based on the context data; and
receiving, from the LLM, an answer to the context-enhanced query; and
displaying, on a user display, a response that is based on the answer.

### Claim 7 (depends on 1)

The method of claim 1, wherein the instructions direct the LLM to return a function call to one or multiple functions that the LLM identifies as relevant to the conversation history data, and wherein the method further comprises:
in response to determining that the function selection response includes multiple function calls identifying multiple different data sources:
retrieving, from each of the multiple different data sources, potentially-relevant data chunks satisfying similarity criteria with the query;
defining, based on the potentially-relevant data chunks retrieved with respect to each of the multiple different data sources, a set of most relevant data chunks; and
generating a context-enhanced query that includes the set of most relevant data chunks, the query, and an instruction to answer the query using the set of most relevant data chunks;
receiving, from the LLM, an answer to the context-enhanced query; and
displaying, on a user display, a response that is based on the answer.

### Claim 8 (depends on 7)

The method of claim 7, wherein generating the set of most relevant data chunks further comprises:
ranking the potentially-relevant data chunks retrieved with respect to each of the multiple different data sources based on respective similarity to the conversation history data;
selecting a number N of highest-ranked data chunks.

### Claim 9 (depends on 7)

The method of claim 7, wherein generating the set of most relevant data chunks further comprises:
generating, via a trained summarization model, summaries of the potentially-relevant data chunks;
generating one or more combined data chunks that each includes two or more of the summaries concatenated together, wherein the set of most relevant data chunks includes the one or more combined data chunks.

### Claim 10

A system comprising:
a retrieval augmented generative (RAG) assistant stored in memory and executable to:
transmit a function selection instruction prompt to a large language model (LLM) in response to receiving, from a user compute system, conversation history data including a query, the function selection instruction prompt including:
the conversation history data;
a function list including function definitions that each correspond to a data source and include a function descriptor that describes content of the data source; and ; and
instructions directing the LLM to return a function call to at least one function on the function list identified as relevant to the conversation history data based on the corresponding function descriptor; and
receive, in response to transmission of the function selection instruction prompt, a function selection response from the LLM that includes the function call;
select, based on the least one function identified within the function selection response, a conditional operation from multiple defined conditional operations; and
execute, by the RAG assistant, the conditional operation.

### Claim 11 (depends on 10)

The system of claim 10, wherein the function list includes an out-of-domain function with a function descriptor that instructs the LLM to select the out-of-domain function in response to determining that no other function on the function list is relevant to the conversation history data.

### Claim 12 (depends on 11)

The system of claim 11, wherein the at least one function identified within the function selection instruction prompt identifies the out-of-domain function and the conditional operation provides for transmitting a response, to the user compute system, that indicates the query could not be answered using available data sources.

### Claim 13 (depends on 11)

The system of claim 11, wherein the function selection instruction prompt further includes potentially-relevant data chunks mined from one or more data sources and the function list includes a particular function with a function descriptor that instructs the LLM to select the particular function in response to determining that the potentially-relevant data chunks are usable to answer the query.

### Claim 14 (depends on 10)

The system of claim 10, wherein the RAG assistant is further executable to:
determine that the function call corresponds to a select data source:
retrieve, from the select data source, potentially-relevant data chunks satisfying similarity criteria with the conversation history data;
transmit a context-enhanced query to the LLM, the context-enhanced query including:
the query;
context data including the potentially-relevant data chunks; and
an instruction directing the LLM to answer the context-enhanced query based on the context data; and
receive, from the LLM, an answer to the context-enhanced query; and
display, on a user display, a response that is based on the answer.

### Claim 15 (depends on 10)

The system of claim 10, wherein the instructions in the function selection instruction prompt direct the LLM to return function calls to one or multiple functions that the LLM identifies as relevant to the conversation history data, and wherein the RAG assistant is further executable to:
determine that the function selection response includes multiple function calls corresponding to multiple different data sources:
retrieve, from each of the multiple different data sources, potentially-relevant data chunks satisfying similarity criteria with the conversation history data;
define, based on the potentially-relevant data chunks retrieved with respect to each of the multiple different data sources, a set of most relevant data chunks; and
generate a context-enhanced query that includes the set of most relevant data chunks, the query, and a final instruction directing the LLM to answer the query using the set of most relevant data chunks;
receive from the LLM, an answer to the context-enhanced query; and
display, on a user display, a response that is based on the answer.

### Claim 16 (depends on 15)

The system of claim 15, wherein the RAG assistant is further executable to:
generate the set of most relevant data chunks at least in part by:
ranking the potentially-relevant data chunks retrieved with respect to each of the multiple different data sources based on respective similarity to the conversation history data; and
selecting a number N of highest-ranked data chunks.

### Claim 17 (depends on 15)

The system of claim 15, wherein the RAG assistant is further executable to:
generate the set of most relevant data chunks at least in part by:
generating, via a trained summarization model, summaries of the potentially-relevant data chunks; and
generate one or more combined data chunks that each includes two or more of the summaries concatenated together, wherein the set of most relevant data chunks includes the one or more combined data chunks.

### Claim 18

One or more tangible computer-readable storage media encoding instructions for executing a computer process, the computer process comprising:
receiving, from a user compute system, conversation history data including a query;
generating, by a retrieval augmented generative (RAG) assistant, a function selection instruction prompt for a large language model (LLM), the function selection instruction prompt including:
the conversation history data;
a function list defining:
a first set of function definitions, each function definition in the first set corresponding to a data source and including a function descriptor that describes content of the data source; and
an out-of-domain function with a function descriptor that instructs the LLM to select the out-of-domain function in response to determining that no other function on the function list is relevant to the conversation history data;
instructions directing the LLM to return a function call to at least one function on the function list identified as relevant to the conversation history data based on the corresponding function descriptor; and
receiving, at the RAG assistant, a function selection response from the LLM including a call to the out-of-domain function;
transmitting a response to the user compute system in response to determining that the function selection response identifies the out-of-domain function, the response indicating that the query could not be answered using available data sources.

### Claim 19 (depends on 18)

The one or more tangible computer-readable storage media of claim 18, wherein the function selection instruction prompt further includes potentially-relevant data chunks mined from one or more data sources and the function list includes a particular function with a function descriptor that instructs the LLM to select the particular function in response to determining that the potentially-relevant data chunks are usable to answer the query.

### Claim 20 (depends on 19)

The one or more tangible computer-readable storage media of claim 19,
transmitting, to the LLM, a context-enhanced query in response to determining that the function selection response identifies the particular function, the context-enhanced query including: the query, context data including the potentially-relevant data chunks, and an instruction directing the LLM to answer the context-enhanced query based on the context data.
