Use a LlamaIndex Query Pipeline agent

In addition to the general instructions for using an agent , this page describes features that are specific to LlamaIndexQueryPipelineAgent .

Before you begin

This tutorial assumes that you have read and followed the instructions in:

Supported operations

The following operations are supported for LlamaIndexQueryPipelineAgent :

  • query : for getting a response to a query synchronously.

The query method supports the following type of argument:

  • input : the messages to be sent to the agent.

Query the agent

The command:

  agent 
 . 
 query 
 ( 
 input 
 = 
 "What is Paul Graham's life in college?" 
 ) 
 

is equivalent to the following (in full form):

  agent 
 . 
 query 
 ( 
 input 
 = 
 { 
 "input" 
 : 
 "What is Paul Graham's life in college?" 
 }) 
 

To customize the input dictionary, see Customize the prompt template .

You can also customize the agent's behavior beyond input by passing additional keyword arguments to query() .

  response 
 = 
 agent 
 . 
 query 
 ( 
 input 
 = 
 { 
 "input" 
 = 
 [ 
 "What is Paul Graham's life in college?" 
 , 
 "How did Paul Graham's college experience shape his career?" 
 , 
 "How did Paul Graham's college experience shape his entrepreneurial mindset?" 
 , 
 ], 
 }, 
 batch 
 = 
 True 
 # run the pipeline in batch mode and pass a list of inputs. 
 ) 
 print 
 ( 
 response 
 ) 
 

See the QueryPipeline.run code for a complete list of available parameters.

What's next

Create a Mobile Website
View Site in Mobile | Classic
Share by: