Skip to content

Tool message display

assistant_message = RxMessage(role=MessageRoles.ASSISTANT, content=f'This is an assistant message{lorem.paragraphs(2)}') module-attribute

system_message = MessageSchema(role=MessageRoles.SYSTEM, content=f'This is a system message{lorem.sentence()}') module-attribute

tool_call_message = MessageSchema(role=MessageRoles.TOOL_CALL, content='Should be ignored', tool_calls=[FunctionCallSchema(index=0, call_id='call_test_id_1', name='fake_tool_1', arguments={'arg1': 'value1', 'arg2': 'value2'}), FunctionCallSchema(index=1, call_id='call_test_id_2', name='fake_tool_2', arguments={'another1': 'different1', 'another2': 'different2'}), FunctionCallSchema(index=2, call_id='call_test_id_3', name='fake_tool_3', arguments={'query': 'query str'})]) module-attribute

tool_response_message1 = MessageSchema(role=MessageRoles.TOOL_RESPONSE, content='[{"url": "https://fake.url", "content": "Fake Content"}]', tool_response=FunctionResponseSchema(call_id='call_test_id_1', name='fake_tool_1', artifact={'answer': 'fake answer', 'follow_up_questions': ['fake follow up 1'], 'images': [], 'query': 'test_input', 'response_time': 0.1, 'results': [{'content': 'Fake Content', 'published_date': None, 'raw_content': 'Fake Raw Content', 'score': 0.98, 'title': 'Fake Title', 'url': 'https://fake.url'}]})) module-attribute

tool_response_message2 = MessageSchema(role=MessageRoles.TOOL_RESPONSE, content=_temp_dict_json, tool_response=FunctionResponseSchema(call_id='call_test_id_2', name='fake_tool_2', artifact={'a': lorem.sentence(), 'b': {'c': lorem.sentence(), 'd': lorem.sentence()}, 'e': lorem.paragraphs(1)})) module-attribute

tool_response_message3 = MessageSchema(role=MessageRoles.TOOL_RESPONSE, content=f'Text only response from tool{lorem.paragraphs(1)}', tool_response=FunctionResponseSchema(call_id='call_test_id_3', name='fake_tool_3', artifact={'a': lorem.sentence(), 'b': {'c': lorem.sentence(), 'd': lorem.sentence()}, 'e': lorem.paragraphs(1)})) module-attribute

user_message = MessageSchema(role=MessageRoles.USER, content=f'This is a user message{lorem.paragraphs(2)}') module-attribute

MessageState

Bases: MyState

messages = RxMessageOrToolGroup.list_from_schemas([system_message, user_message, tool_call_message, tool_response_message1, tool_response_message2, tool_response_message3, assistant_message]) class-attribute instance-attribute

do_reset()

set_tool_group_info_level(index, info_level)

index_()

message_or_tool_group(item)