(beta) Agentic Search

Functionality

The Agentic Search module is designed to handle complex user queries by leveraging multiple search types and iterative search runs to provide accurate and comprehensive answers. It can manage single questions, nested questions, or queries containing multiple questions. The module dynamically determines the optimal search strategy and iteratively refines its responses while ensuring hallucination checks and quality control.

The Agentic Search performs the following tasks:

  1. Determines the appropriate search type for the user query:

    1. Based on the input, the assistant decides whether to use internal knowledge search, web search, table search, or other configured search types.

    2. The choice of search type is based on the query’s structure and content.

  2. Executes searches iteratively:

    1. Conducts an initial search using the selected search type.

    2. Evaluates whether additional searches are required based on the initial results.

    3. Repeats the search process until the relevant information for the query is gathered.

  3. Handles nested and multi-question inputs:

    1. Parses the user query into its components.

    2. Conducts separate searches for each component as necessary, combining results to form a comprehensive answer.

  4. Performs hallucination checks:

    1. After streaming an initial response, the module evaluates the response for hallucinations.

    2. If a hallucination is detected, the module iterates to correct its response using previous answers and hallucination check feedback. If required, further information is gathered with additional searches.

  5. Suggstion of follow-up questions:

    1. Appends a configurable number of suggested follow-up questions based on the provided answer and the conversation history.

Input

A user message containing a query, which can be:

  • A single question

  • A nested question

  • A set of multiple questions

Example scenario:

User query: “What is the market trend in Europe for 2024, and how does it compare to the US?”

Process:

  • The module identifies the need for both internal knowledge search and web search.

  • It performs separate searches for “market trend in Europe for 2024” and “comparison with the US.”

  • The results are combined and iteratively refined to ensure accuracy and coherence. The answer is streamed to the user.

  • A hallucination check validates the response, triggering corrections if necessary.

  • After a successful hallucination check, follow-up questions are suggested to the user like:

    • “Would you like a regional breakdown of trends?”

    • “Do you want details on specific industries?”

Output

A comprehensive, accurate answer to the user query, which:

  • Combines insights from multiple search types and iterative search runs.

  • Includes follow-up questions for further exploration.

Configuration:

AI assistant module configuration (see variable explanation below)

 

{ "languageModel": "AZURE_GPT_4o_2024_0513", "maxLoopIterations": 5, "tools": [ { "name": "InternalSearch", "configuration": { "languageModel": "AZURE_GPT_4o_2024_0513", "scopeIds": ["scope_A", "scope_B"] "maxTokensForSources": 14000, "chunkRelevancySortConfig": { "enabled": true, "languageModel": "AZURE_GPT_4o_MINI_2024_0718" } } }, { "name": "WebSearch", "configuration": { "languageModel": "AZURE_GPT_4o_2024_0513", "maxTokensForSources": 14000, "chunkRelevancySortConfig": { "enabled": true, "languageModel": "AZURE_GPT_4o_MINI_2024_0718" } } } ], "evaluationConfig": { "maxReviewSteps": 2, "evaluationPassValues": [ "low", "medium" ] }, "followUpQuestionsConfig": { "languageModel": "AZURE_GPT_4o_MINI_2024_0718", "numberOfFollowUpQuestions": 2 } }

 

Attribute

Description

Type

Attribute

Description

Type

languageModel

Defines the default model used by the agent

Text enum (depending on availability): “AZURE_GPT_4o_2024_0513“,
”AZURE_GPT_4_0613”,

maxLoopIterations

Max. number of loop iterations done by the agent to answer the question

Number

tools

List of tools (see below for specific search types and configurations)

 

name

Name of search type

Name of search type:

  • InternalSearch

  • WebSearch

configuration

Configuration of search

Depends on search type. See below for more details

evaluationConfig

 

 

maxReviewSteps

Specifies the maximum number of review steps allowed if the evaluation check is not passed.

Number

evaluationPassValues

Defines the pass levels for evaluation checks. The levels can be categorised as low, medium, or high.

Possible Values:

  • ["low"]

  • ["low", "medium"]

  • ["low", "medium", "high"]

 

followUpQuestionsConfig

 

 

languageModel

Defines the model used for generation of follow-up questions

Text enum (depending on availability): “AZURE_GPT_4o_2024_0513“,
”AZURE_GPT_4_0613”,

numberOfFollowUpQuestions

Specifies the number of follow-up questions to generate

Number

Internal Knowledge Search

Search in information in the knowledge base

Attribute

Description

Type

Attribute

Description

Type

languageModel

Specifies the model used in the internal search tool.

Text enum (depending on availability):

  • "AZURE_GPT_4o_2024_0513",

  • "AZURE_GPT_4_0613",

  • ...

maxTokensForSources

Defines the maximum number of tokens for the returned search results. The search results are provided in chunks.

Number

scopeIds

Defines scopes the search is performed on.

List of scope IDs

chunkRelevancySortConfig

 

 

enabled

Indicates whether chunk relevancy sorting is activated.

Boolean

languageModel

Specifies the model used for chunk relevancy sorting.

Text enum (depending on availability):

  • "AZURE_GPT_4o_2024_0513",

  • "AZURE_GPT_4_0613",

  • ...

Web Search

Search in the internet.

Attribute

Description

Type

Attribute

Description

Type

languageModel

Specifies the model used in the internal search tool.

Text enum (depending on availability):

  • "AZURE_GPT_4o_2024_0513",

  • "AZURE_GPT_4_0613",

  • ...

maxTokensForSources

Defines the maximum number of tokens for the returned search results. The search results are provided in chunks.

Number

chunkRelevancySortConfig

 

 

enabled

Indicates whether chunk relevancy sorting is activated.

Boolean

languageModel

Specifies the model used for chunk relevancy sorting.

Text enum (depending on availability):

  • "AZURE_GPT_4o_2024_0513",

  • "AZURE_GPT_4_0613",

  • ...

 

(Tool) Definition

Only adjust function definition if you are fully familiar with the code logic. Small changes can break the module or reduce the output quality.

{ "type": "function", "function": { "name": "AgenticSearch", "parameters": { "type": "object", "required": [ "instruction", "language" ], "properties": { "language": { "type": "string", "description": "The language used by the user in their prompt (e.g. English, French, German, etc.)." }, "instruction": { "type": "string", "description": "The semantic query to search. Should be the form of a semantic query containing all relevant information." } }, "description": "Search for information on policies, procedures, benefits, groups, stocks or specific people. This should be your go-to tool if no other tools are applicable." } } }

Author

@Fabian Schläpfer

© 2024 Unique AG. All rights reserved. Privacy PolicyTerms of Service