Assistant#
- pydantic model Assistant[source]#
Bases:
BaseModelFull language assistant model
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.
- Config:
arbitrary_types_allowed: bool = True
- Fields:
- field conversation_agent: BaseConversationAgent = ConversationAgent(llm_chain=LLMChain(memory=ConversationBufferMemory(chat_memory=ChatMessageHistory(messages=[]), output_key=None, input_key='human_input', return_messages=False, human_prefix='Human', ai_prefix='Assistant', memory_key='history'), callbacks=None, callback_manager=None, verbose=False, prompt=PromptTemplate(input_variables=['language', 'topic', 'proficiency', 'history', 'human_input'], output_parser=None, partial_variables={}, template="Assistant is a native {language} language teacher. that teaches by using realistic conversations and scenarios. Assistant is in a face-to-face verbal conversation with the student. Assistant should actively guide the conversation to teach the student {language} Assistant must end any replies with <END_REPLY>. If the student wishes to end the conversation or move on to a new topic, Assistant must reply with <END_CONVERSATION>. The following is a conversation between Assistant and a student. Provide Assistant's next response. \nConversation topic: {topic}\nStudent proficiency: {proficiency}\n\n{history}\nHuman: {human_input}\nAssistant:", template_format='f-string', validate_template=True), llm=ChatOpenAI(verbose=False, callbacks=None, callback_manager=None, client=<class 'openai.api_resources.chat_completion.ChatCompletion'>, model_name='gpt-3.5-turbo', temperature=0.0, model_kwargs={}, openai_api_key=None, openai_organization=None, request_timeout=None, max_retries=6, streaming=False, n=1, max_tokens=None), output_key='text'), stop=['<END_REPLY>'])#
Agent to use for conversing about a topic
- field language: str [Required]#
Target language
- field lesson_agent: BasePlannerAgent = LessonPlannerAgent(llm_chain=LLMChain(memory=None, callbacks=None, callback_manager=None, verbose=False, prompt=ChatPromptTemplate(input_variables=['language', 'proficiency'], output_parser=None, partial_variables={}, messages=[SystemMessage(content="Please output the requested list of broad lesson topics starting with the header 'Topics:' and then followed by a numbered list of topics. Please include enough general topics that a language teacher could effectively teach the language for the given skill level. At the end of your list of topics, say '<END_OF_LIST>'", additional_kwargs={}), HumanMessagePromptTemplate(prompt=PromptTemplate(input_variables=['language', 'proficiency'], output_parser=None, partial_variables={}, template='Write a list of lesson topics for a person learning {language} through immersion by speaking with a native speaker of {language}. The learner has {proficiency} level experience with {language}. Tailor the lesson topics for the native instructor for the level of experience the learner has.', template_format='f-string', validate_template=True), additional_kwargs={})]), llm=ChatOpenAI(verbose=False, callbacks=None, callback_manager=None, client=<class 'openai.api_resources.chat_completion.ChatCompletion'>, model_name='gpt-3.5-turbo', temperature=0.0, model_kwargs={}, openai_api_key=None, openai_organization=None, request_timeout=None, max_retries=6, streaming=False, n=1, max_tokens=None), output_key='text'), output_parser=LessonOutputParser(), stop=['<END_OF_LIST>'])#
Agent to use for planning lessons
- field llm: BaseLanguageModel = ChatOpenAI(verbose=False, callbacks=None, callback_manager=None, client=<class 'openai.api_resources.chat_completion.ChatCompletion'>, model_name='gpt-3.5-turbo', temperature=0.0, model_kwargs={}, openai_api_key=None, openai_organization=None, request_timeout=None, max_retries=6, streaming=False, n=1, max_tokens=None)#
Language model for inference
- field proficiency: str [Required]#
User proficiency with target language
- field transcriber: Transcriber [Required]#
Voice transcription model
- field use_tts: bool = True#
If TTS should be used or not
- run(include_topic_background: bool, lesson: List[str] | None = None) None[source]#
Full assistant lesson planning, background teaching, and conversation loop
- Parameters:
include_topic_background – If the user wants background teaching before starting the conversation
lesson – An optional custom lesson plan of topics to discuss
- speak(topic: str, human_input: str) str[source]#
Single response from user’s conversation input about a topic
- property background: Dict[str, str]#
User target language background