Handling GenAI query objects
You can create an instance of one of the query classes to create a GenAI query object that processes an input prompt.
Creating a GenAI query object
A client creates a new instance of one of the query classes, sets one or more of the properties, and then saves the object. The Content Engine server processes the request and makes one or multiple calls to the watsonx LLM based on the input properties of the object. The output properties are then set to the same object by recording the watsonx LLM response.
You can specify the input prompt for the LLM by setting the GenaiLLMPrompt
property value for the GenAI query object instance that you created. You can also optionally specify
the LLM model name by setting the GenaiLLMModelName property value for the GenAI
query object instance.
Retrieving a GenAI query object
You can retrieve the generated LLM inferences by using the GenaiLLMResponse
property of the GenAI query object. The GenaiLLMResponse value contains answers to
your questions based on the documents that you have access to.
If the API call did not include the REFRESH flag when the query object was
created, you need to include a separate retrieval call to obtain the results of the query object
creation.
Querying a GenAI query object
Every query object that is created during an API call, contains generative AI responses to user questions. So, when you make a Content Engine API call as a user, you can discover the query objects that you created and that are based on documents that you can access. A different user might not have access to the same documents and hence cannot see the resulting generative AI response. However, if you are an object store administrator, you can see query objects that are created by all users.
Your custom application can show a history of all genAI queries performed by the current user, by issuing a query for that user.