857857 },
858858 {
859859 "cell_type" : " code" ,
860- "execution_count" : 37 ,
860+ "execution_count" : null ,
861861 "id" : " b339b7b1-3198-4fd9-9a53-7940dcc20437" ,
862862 "metadata" : {},
863- "outputs" : [
864- {
865- "data" : {
866- "text/html" : [
867- " \n " ,
868- " <style>\n " ,
869- " .message-container, .usage-container {\n " ,
870- " font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n " ,
871- " max-width: 800px;\n " ,
872- " margin: 20px auto;\n " ,
873- " background-color: #1e1e1e;\n " ,
874- " border-radius: 8px;\n " ,
875- " overflow: hidden;\n " ,
876- " color: #d4d4d4;\n " ,
877- " }\n " ,
878- " .message, .usage-stats {\n " ,
879- " padding: 10px 15px;\n " ,
880- " border-bottom: 1px solid #3a3a3a;\n " ,
881- " }\n " ,
882- " .message:last-child, .usage-stats:last-child {\n " ,
883- " border-bottom: none;\n " ,
884- " }\n " ,
885- " .title {\n " ,
886- " font-weight: bold;\n " ,
887- " margin-bottom: 5px;\n " ,
888- " color: #ffffff;\n " ,
889- " text-transform: uppercase;\n " ,
890- " font-size: 0.9em;\n " ,
891- " }\n " ,
892- " .content {\n " ,
893- " background-color: #2d2d2d;\n " ,
894- " border-radius: 4px;\n " ,
895- " padding: 5px 10px;\n " ,
896- " font-family: 'Consolas', 'Courier New', monospace;\n " ,
897- " white-space: pre-wrap;\n " ,
898- " }\n " ,
899- " .json-key, .function-name, .json-boolean { color: #9cdcfe; }\n " ,
900- " .json-string { color: #ce9178; }\n " ,
901- " .json-number { color: #b5cea8; }\n " ,
902- " .internal-monologue { font-style: italic; }\n " ,
903- " </style>\n " ,
904- " <div class=\" message-container\" >\n " ,
905- " \n " ,
906- " <div class=\" message\" >\n " ,
907- " <div class=\" title\" >FUNCTION CALL</div>\n " ,
908- " <div class=\" content\" ><span class=\" function-name\" >tavily_search_results</span>({<br> <span class=\" json-key\" >\" query\" </span>: <span class=\" json-key\" >\" Who founded OpenAI\" ,<br> \" request_heartbeat\" </span>: <span class=\" json-boolean\" >true</span><br>})</div>\n " ,
909- " </div>\n " ,
910- " \n " ,
911- " <div class=\" message\" >\n " ,
912- " <div class=\" title\" >FUNCTION RETURN</div>\n " ,
913- " <div class=\" content\" >{<br> <span class=\" json-key\" >\" status\" </span>: <span class=\" json-key\" >\" Failed\" ,<br> \" message\" </span>: <span class=\" json-key\" >\" Error calling function tavily_search_results: module langchain_community.tools has no attribute TavilySearchAPIWrapper\" ,<br> \" time\" </span>: <span class=\" json-string\" >\" 2024-11-13 05:40:04 PM PST-0800\" </span><br>}</div>\n " ,
914- " </div>\n " ,
915- " \n " ,
916- " <div class=\" message\" >\n " ,
917- " <div class=\" title\" >INTERNAL MONOLOGUE</div>\n " ,
918- " <div class=\" content\" ><span class=\" internal-monologue\" >The search function seems to have encountered an error. Let's attempt to answer the user's question another way.</span></div>\n " ,
919- " </div>\n " ,
920- " \n " ,
921- " <div class=\" message\" >\n " ,
922- " <div class=\" title\" >FUNCTION CALL</div>\n " ,
923- " <div class=\" content\" ><span class=\" function-name\" >send_message</span>({<br> <span class=\" json-key\" >\" message\" </span>: <span class=\" json-string\" >\" OpenAI was founded by Elon Musk, Sam Altman, Greg Brockman, Ilya Sutskever, John Schulman and Wojciech Zaremba in December 2015. However, please note that Elon Musk is no longer associated with the organization.\" </span><br>})</div>\n " ,
924- " </div>\n " ,
925- " \n " ,
926- " <div class=\" message\" >\n " ,
927- " <div class=\" title\" >FUNCTION RETURN</div>\n " ,
928- " <div class=\" content\" >{<br> <span class=\" json-key\" >\" status\" </span>: <span class=\" json-key\" >\" OK\" ,<br> \" message\" </span>: <span class=\" json-key\" >\" None\" ,<br> \" time\" </span>: <span class=\" json-string\" >\" 2024-11-13 05:40:09 PM PST-0800\" </span><br>}</div>\n " ,
929- " </div>\n " ,
930- " </div>\n " ,
931- " <div class=\" usage-container\" >\n " ,
932- " <div class=\" usage-stats\" >\n " ,
933- " <div class=\" title\" >USAGE STATISTICS</div>\n " ,
934- " <div class=\" content\" >{<br> <span class=\" json-key\" >\" completion_tokens\" </span>: <span class=\" json-number\" >120</span>,<br> <span class=\" json-key\" >\" prompt_tokens\" </span>: <span class=\" json-number\" >4737</span>,<br> <span class=\" json-key\" >\" total_tokens\" </span>: <span class=\" json-number\" >4857</span>,<br> <span class=\" json-key\" >\" step_count\" </span>: <span class=\" json-number\" >2</span><br>}</div>\n " ,
935- " </div>\n " ,
936- " </div>\n " ,
937- " "
938- ],
939- "text/plain" : [
940- "LettaResponse(messages=[FunctionCallMessage(id='message-31269f23-f32a-4267-ac85-b4548c56a1dd', date=datetime.datetime(2024, 11, 14, 1, 40, 4, 928751, tzinfo=datetime.timezone.utc), message_type='function_call', function_call=FunctionCall(name='tavily_search_results', arguments='{\\n \"query\": \"Who founded OpenAI\",\\n \"request_heartbeat\": true\\n}', function_call_id='call_EMmwx5mNy2vEttk97GDMjYwy')), FunctionReturn(id='message-a1e13057-6244-44c8-8ee5-2e057e5bed2d', date=datetime.datetime(2024, 11, 14, 1, 40, 4, 931214, tzinfo=datetime.timezone.utc), message_type='function_return', function_return='{\\n \"status\": \"Failed\",\\n \"message\": \"Error calling function tavily_search_results: module langchain_community.tools has no attribute TavilySearchAPIWrapper\",\\n \"time\": \"2024-11-13 05:40:04 PM PST-0800\"\\n}', status='error', function_call_id='call_EMmwx5mNy2vEttk97GDMjYwy'), InternalMonologue(id='message-0cb514d9-0874-43e8-b537-6bfcceeb9875', date=datetime.datetime(2024, 11, 14, 1, 40, 9, 498385, tzinfo=datetime.timezone.utc), message_type='internal_monologue', internal_monologue=\"The search function seems to have encountered an error. Let's attempt to answer the user's question another way.\"), FunctionCallMessage(id='message-0cb514d9-0874-43e8-b537-6bfcceeb9875', date=datetime.datetime(2024, 11, 14, 1, 40, 9, 498385, tzinfo=datetime.timezone.utc), message_type='function_call', function_call=FunctionCall(name='send_message', arguments='{\\n \"message\": \"OpenAI was founded by Elon Musk, Sam Altman, Greg Brockman, Ilya Sutskever, John Schulman and Wojciech Zaremba in December 2015. However, please note that Elon Musk is no longer associated with the organization.\"\\n}', function_call_id='call_MiF3dvSF7ImLBoOOwugKpZLy')), FunctionReturn(id='message-2e27c5ce-574e-4135-8486-f586a42b020c', date=datetime.datetime(2024, 11, 14, 1, 40, 9, 499244, tzinfo=datetime.timezone.utc), message_type='function_return', function_return='{\\n \"status\": \"OK\",\\n \"message\": \"None\",\\n \"time\": \"2024-11-13 05:40:09 PM PST-0800\"\\n}', status='success', function_call_id='call_MiF3dvSF7ImLBoOOwugKpZLy')], usage=LettaUsageStatistics(completion_tokens=120, prompt_tokens=4737, total_tokens=4857, step_count=2))"
941- ]
942- },
943- "execution_count" : 37 ,
944- "metadata" : {},
945- "output_type" : " execute_result"
946- }
947- ],
948- "source" : [
949- " response = client.agents.messages.send(\n " ,
950- " agent_id=agent_state.id, \n " ,
951- " messages=[\n " ,
952- " MessageCreate(\n " ,
953- " role=\" user\" ,\n " ,
954- " content=\" Who founded OpenAI?\" ,\n " ,
955- " )\n " ,
956- " ],\n " ,
957- " )\n " ,
958- " response"
959- ]
863+ "outputs" : [],
864+ "source" : " response = client.agents.messages.create(\n agent_id=agent_state.id, \n messages=[\n MessageCreate(\n role=\" user\" ,\n content=\" Who founded OpenAI?\" ,\n )\n ],\n )\n response"
960865 }
961866 ],
962867 "metadata" : {
980885 },
981886 "nbformat" : 4 ,
982887 "nbformat_minor" : 5
983- }
888+ }
0 commit comments