agentkit.after_query

Classes

BaseAfterQuery()

Base class for after query postprocessing.

JsonAfterQuery()

Class for after query postprocessing of Json objects.

class agentkit.after_query.BaseAfterQuery

Base class for after query postprocessing.

Each after query instance performs postprocessing after the LLM query.

node

The Node object that this after-query instance is associated with.

Type:

SimpleDBNode

post_process()

Post process the result of the LLM query.

This method can be overridden by the derived class to perform postprocessing.

set_node(node)

Set the node for the after query.

This function will be called automatically upon initialization of a SimpleDBNode

Parameters:

node (SimpleDBNode) – Node object.

class agentkit.after_query.JsonAfterQuery

Class for after query postprocessing of Json objects.

type

Type of the Json object.

Type:

type

required_keys

List of required keys in the Json object.

Type:

list

length

Required length of the Json object.

Type:

int

parse_json()

Parse the result of the LLM query.

This method parses self.node.result (str) and returns the parsed Json object. The method checks the length of the parsed Json object, and if the Json object contains the required keys.

Raises:

AfterQueryError – If the answer is invalid.

Returns:

List of Json objects, where the last Json object is the answer.

Return type:

parsed_answer (list of dict)