ConversationAgent#

pydantic model ConversationAgent[source]#

Bases: BaseConversationAgent

LLM agent for conversing about a topic in the target language

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
field llm_chain: LLMChain [Required]#

Any LLM chain for inference

field stop: List | None = None#

LLM end-of-response keyword

greet(inputs: Dict[str, str], callbacks: List[BaseCallbackHandler] | BaseCallbackManager | None = None) → str[source]#

Start a new conversation about a topic.

speak(inputs: Dict[str, str], callbacks: List[BaseCallbackHandler] | BaseCallbackManager | None = None) → str[source]#

Get single response to user input

Parameters:
  • inputs –

    Conversation inputs dictionary. Expects:

    • language: target language (optional)

    • proficiency: user proficiency with target language (optional)

    • topic: the topic to discuss (optional)

    • input: the current user input in the conversation

  • callbacks – LangChain LLM callbacks

Returns:

Single LLM response

Return type:

str