diff --git a/examples/cloud_examples/background_run.ipynb b/examples/cloud_examples/background_run.ipynb index a41fafa60..7199a4a17 100644 --- a/examples/cloud_examples/background_run.ipynb +++ b/examples/cloud_examples/background_run.ipynb @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "b8e6408a-b37e-428f-9567-077fa55d58e8", "metadata": {}, "outputs": [], @@ -26,22 +26,22 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 2, "id": "4947e9bc-111f-4991-8c41-1041da9bf0ba", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[{'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca',\n", - " 'graph_id': 'agent',\n", - " 'config': {},\n", - " 'created_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'updated_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'metadata': {'created_by': 'system'}}]" + "{'assistant_id': 'e90fee30-be91-43aa-a33c-d54bd219072e',\n", + " 'graph_id': 'agent',\n", + " 'created_at': '2024-06-18T18:06:55.102231+00:00',\n", + " 'updated_at': '2024-06-18T18:06:55.102231+00:00',\n", + " 'config': {'configurable': {'model_name': 'anthropic'}},\n", + " 'metadata': {}}" ] }, - "execution_count": 7, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -49,53 +49,36 @@ "source": [ "# List available assistants\n", "assistants = await client.assistants.search()\n", - "assistants" + "assistants[0]" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 3, "id": "230c0464-a6e5-420f-9e38-ca514e5634ce", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca',\n", - " 'graph_id': 'agent',\n", - " 'config': {},\n", - " 'created_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'updated_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'metadata': {'created_by': 'system'}}" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "# Get the first assistant, we will use this one\n", - "assistant = assistants[0]\n", - "assistant" + "# NOTE: we can use `assistant_id` UUID from the above response, or just pass graph ID instead when creating runs. we'll use graph ID here\n", + "assistant_id = \"agent\"" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 4, "id": "56aa5159-5583-4134-9210-709b969bda6f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", - " 'created_at': '2024-05-18T00:50:26.367620+00:00',\n", - " 'updated_at': '2024-05-18T00:50:26.367620+00:00',\n", + "{'thread_id': '5fc20631-47b7-48cd-8aa2-9f2eace9778d',\n", + " 'created_at': '2024-06-21T14:58:02.079462+00:00',\n", + " 'updated_at': '2024-06-21T14:58:02.079462+00:00',\n", " 'metadata': {}}" ] }, - "execution_count": 10, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -108,7 +91,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 5, "id": "147c3f98-f889-4f05-a090-6b31f2a0b291", "metadata": {}, "outputs": [ @@ -118,7 +101,7 @@ "[]" ] }, - "execution_count": 11, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -131,35 +114,51 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "8c7b44ef-4816-496d-88a1-2f7327cf576d", "metadata": {}, "outputs": [], "source": [ "# Let's kick off a run\n", "input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in sf\"}]}\n", - "run = await client.runs.create(thread['thread_id'], assistant[\"assistant_id\"], input=input)\n" + "run = await client.runs.create(thread['thread_id'], assistant_id, input=input)" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 7, "id": "d84b4d80-b0aa-4d9f-a05d-0744b2fe8f72", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'run_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", + "{'run_id': '1ef2fdea-814c-6165-8b2a-a40e2a028198',\n", + " 'thread_id': '5fc20631-47b7-48cd-8aa2-9f2eace9778d',\n", " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca',\n", - " 'created_at': '2024-05-18T00:50:27.618761+00:00',\n", - " 'updated_at': '2024-05-18T00:50:27.618761+00:00',\n", + " 'created_at': '2024-06-21T14:58:02.095911+00:00',\n", + " 'updated_at': '2024-06-21T14:58:02.095911+00:00',\n", + " 'metadata': {},\n", " 'status': 'pending',\n", - " 'metadata': {}}" + " 'kwargs': {'input': {'messages': [{'role': 'human',\n", + " 'content': 'what's the weather in sf'}]},\n", + " 'config': {'metadata': {'created_by': 'system'},\n", + " 'configurable': {'run_id': '1ef2fdea-814c-6165-8b2a-a40e2a028198',\n", + " 'user_id': '',\n", + " 'graph_id': 'agent',\n", + " 'thread_id': '5fc20631-47b7-48cd-8aa2-9f2eace9778d',\n", + " 'thread_ts': None,\n", + " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca'}},\n", + " 'webhook': None,\n", + " 'temporary': False,\n", + " 'stream_mode': ['events'],\n", + " 'feedback_keys': None,\n", + " 'interrupt_after': None,\n", + " 'interrupt_before': None},\n", + " 'multitask_strategy': 'reject'}" ] }, - "execution_count": 13, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -171,306 +170,50 @@ }, { "cell_type": "code", - "execution_count": 14, - "id": "ce124bd3-f197-4b73-9ff6-bb36730dd003", - "metadata": { - "scrolled": true - }, - "outputs": [ - { - "data": { - "text/plain": [ - "[{'event_id': '3ac6d963-442f-481c-9fde-b8a27bc0e277',\n", - " 'run_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'received_at': '2024-05-18T00:50:29.570649+00:00',\n", - " 'span_id': 'd4e4a6ee-da2f-4b5f-b656-1a1f73065161',\n", - " 'event': 'on_tool_start',\n", - " 'name': 'tavily_search_results_json',\n", - " 'data': {'input': {'query': 'weather in san francisco'}},\n", - " 'metadata': {'graph_id': 'agent',\n", - " 'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", - " 'created_by': 'system',\n", - " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca'},\n", - " 'tags': ['seq:step:1']},\n", - " {'event_id': 'f8961760-6f13-40e6-9eef-6d4d68e0ed19',\n", - " 'run_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'received_at': '2024-05-18T00:50:29.569708+00:00',\n", - " 'span_id': '73295bb1-6cd3-403d-abc1-4f9d96a63894',\n", - " 'event': 'on_chain_start',\n", - " 'name': 'action',\n", - " 'data': {},\n", - " 'metadata': {'graph_id': 'agent',\n", - " 'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", - " 'created_by': 'system',\n", - " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca'},\n", - " 'tags': ['graph:step:2']},\n", - " {'event_id': '44b5f815-f60c-468f-8d23-96dfdaa0ed20',\n", - " 'run_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'received_at': '2024-05-18T00:50:29.568202+00:00',\n", - " 'span_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'event': 'on_chain_stream',\n", - " 'name': 'LangGraph',\n", - " 'data': {'chunk': {'messages': [{'id': '46b31c3a-01bf-4946-bd5a-fa6a7f6c97ce',\n", - " 'name': None,\n", - " 'type': 'human',\n", - " 'content': 'what's the weather in sf',\n", - " 'example': False,\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {}},\n", - " {'id': 'run-4885d5a0-cd89-4f00-8558-e85b542a710c',\n", - " 'name': None,\n", - " 'type': 'ai',\n", - " 'content': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'name': 'tavily_search_results_json',\n", - " 'type': 'tool_use',\n", - " 'input': {'query': 'weather in san francisco'}}],\n", - " 'example': False,\n", - " 'tool_calls': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'args': {'query': 'weather in san francisco'},\n", - " 'name': 'tavily_search_results_json'}],\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {},\n", - " 'invalid_tool_calls': []}]}},\n", - " 'metadata': {'graph_id': 'agent',\n", - " 'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", - " 'created_by': 'system',\n", - " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca'},\n", - " 'tags': []},\n", - " {'event_id': '0917b31d-f49d-43d4-a8ed-a9eebd8904e8',\n", - " 'run_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'received_at': '2024-05-18T00:50:29.566761+00:00',\n", - " 'span_id': 'f469ac2e-17a3-491c-bc03-0c56aa30a68b',\n", - " 'event': 'on_chain_end',\n", - " 'name': 'agent',\n", - " 'data': {'input': {'messages': [{'role': 'human',\n", - " 'content': 'what's the weather in sf'}]},\n", - " 'output': {'messages': [{'id': 'run-4885d5a0-cd89-4f00-8558-e85b542a710c',\n", - " 'name': None,\n", - " 'type': 'ai',\n", - " 'content': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'name': 'tavily_search_results_json',\n", - " 'type': 'tool_use',\n", - " 'input': {'query': 'weather in san francisco'}}],\n", - " 'example': False,\n", - " 'tool_calls': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'args': {'query': 'weather in san francisco'},\n", - " 'name': 'tavily_search_results_json'}],\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {},\n", - " 'invalid_tool_calls': []}]}},\n", - " 'metadata': {'graph_id': 'agent',\n", - " 'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", - " 'created_by': 'system',\n", - " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca'},\n", - " 'tags': ['graph:step:1']},\n", - " {'event_id': 'bbe33ebf-04ba-43d5-8718-e2da23295675',\n", - " 'run_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'received_at': '2024-05-18T00:50:29.566076+00:00',\n", - " 'span_id': 'f469ac2e-17a3-491c-bc03-0c56aa30a68b',\n", - " 'event': 'on_chain_stream',\n", - " 'name': 'agent',\n", - " 'data': {'chunk': {'messages': [{'id': 'run-4885d5a0-cd89-4f00-8558-e85b542a710c',\n", - " 'name': None,\n", - " 'type': 'ai',\n", - " 'content': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'name': 'tavily_search_results_json',\n", - " 'type': 'tool_use',\n", - " 'input': {'query': 'weather in san francisco'}}],\n", - " 'example': False,\n", - " 'tool_calls': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'args': {'query': 'weather in san francisco'},\n", - " 'name': 'tavily_search_results_json'}],\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {},\n", - " 'invalid_tool_calls': []}]}},\n", - " 'metadata': {'graph_id': 'agent',\n", - " 'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", - " 'created_by': 'system',\n", - " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca'},\n", - " 'tags': ['graph:step:1']},\n", - " {'event_id': '38333127-fa97-4830-8157-f76264778d81',\n", - " 'run_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'received_at': '2024-05-18T00:50:29.564195+00:00',\n", - " 'span_id': 'ef55c681-be15-4f3d-9aee-3a9ff05d8746',\n", - " 'event': 'on_chain_end',\n", - " 'name': 'should_continue',\n", - " 'data': {'input': {'messages': [{'id': 'abc3581e-417b-4ca1-ab31-de7108e64b3b',\n", - " 'name': None,\n", - " 'type': 'human',\n", - " 'content': 'what's the weather in sf',\n", - " 'example': False,\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {}},\n", - " {'id': 'run-4885d5a0-cd89-4f00-8558-e85b542a710c',\n", - " 'name': None,\n", - " 'type': 'ai',\n", - " 'content': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'name': 'tavily_search_results_json',\n", - " 'type': 'tool_use',\n", - " 'input': {'query': 'weather in san francisco'}}],\n", - " 'example': False,\n", - " 'tool_calls': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'args': {'query': 'weather in san francisco'},\n", - " 'name': 'tavily_search_results_json'}],\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {},\n", - " 'invalid_tool_calls': []}]},\n", - " 'output': 'continue'},\n", - " 'metadata': {'graph_id': 'agent',\n", - " 'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", - " 'created_by': 'system',\n", - " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca'},\n", - " 'tags': ['seq:step:3']},\n", - " {'event_id': '408a7785-c715-4bcb-a5aa-950f414baa77',\n", - " 'run_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'received_at': '2024-05-18T00:50:29.563289+00:00',\n", - " 'span_id': 'ef55c681-be15-4f3d-9aee-3a9ff05d8746',\n", - " 'event': 'on_chain_start',\n", - " 'name': 'should_continue',\n", - " 'data': {'input': {'messages': [{'id': 'abc3581e-417b-4ca1-ab31-de7108e64b3b',\n", - " 'name': None,\n", - " 'type': 'human',\n", - " 'content': 'what's the weather in sf',\n", - " 'example': False,\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {}},\n", - " {'id': 'run-4885d5a0-cd89-4f00-8558-e85b542a710c',\n", - " 'name': None,\n", - " 'type': 'ai',\n", - " 'content': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'name': 'tavily_search_results_json',\n", - " 'type': 'tool_use',\n", - " 'input': {'query': 'weather in san francisco'}}],\n", - " 'example': False,\n", - " 'tool_calls': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'args': {'query': 'weather in san francisco'},\n", - " 'name': 'tavily_search_results_json'}],\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {},\n", - " 'invalid_tool_calls': []}]}},\n", - " 'metadata': {'graph_id': 'agent',\n", - " 'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", - " 'created_by': 'system',\n", - " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca'},\n", - " 'tags': ['seq:step:3']},\n", - " {'event_id': '679c8ae7-5cd2-4462-936e-20f0ea45cfb8',\n", - " 'run_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'received_at': '2024-05-18T00:50:29.560628+00:00',\n", - " 'span_id': '4885d5a0-cd89-4f00-8558-e85b542a710c',\n", - " 'event': 'on_chat_model_end',\n", - " 'name': 'ChatAnthropic',\n", - " 'data': {'input': {'messages': [[{'id': None,\n", - " 'name': None,\n", - " 'type': 'human',\n", - " 'content': 'what's the weather in sf',\n", - " 'example': False,\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {}}]]},\n", - " 'output': {'run': None,\n", - " 'llm_output': None,\n", - " 'generations': [[{'text': '',\n", - " 'type': 'ChatGeneration',\n", - " 'message': {'id': 'run-4885d5a0-cd89-4f00-8558-e85b542a710c',\n", - " 'name': None,\n", - " 'type': 'ai',\n", - " 'content': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'name': 'tavily_search_results_json',\n", - " 'type': 'tool_use',\n", - " 'input': {'query': 'weather in san francisco'}}],\n", - " 'example': False,\n", - " 'tool_calls': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'args': {'query': 'weather in san francisco'},\n", - " 'name': 'tavily_search_results_json'}],\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {},\n", - " 'invalid_tool_calls': []},\n", - " 'generation_info': None}]]}},\n", - " 'metadata': {'graph_id': 'agent',\n", - " 'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", - " 'created_by': 'system',\n", - " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca',\n", - " 'ls_model_type': 'chat'},\n", - " 'tags': ['seq:step:1']},\n", - " {'event_id': '055fcf73-36e7-444b-990d-6263ec50925c',\n", - " 'run_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'received_at': '2024-05-18T00:50:29.559491+00:00',\n", - " 'span_id': '4885d5a0-cd89-4f00-8558-e85b542a710c',\n", - " 'event': 'on_chat_model_stream',\n", - " 'name': 'ChatAnthropic',\n", - " 'data': {'chunk': {'id': 'run-4885d5a0-cd89-4f00-8558-e85b542a710c',\n", - " 'name': None,\n", - " 'type': 'AIMessageChunk',\n", - " 'content': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'name': 'tavily_search_results_json',\n", - " 'type': 'tool_use',\n", - " 'input': {'query': 'weather in san francisco'}}],\n", - " 'example': False,\n", - " 'tool_calls': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'args': {'query': 'weather in san francisco'},\n", - " 'name': 'tavily_search_results_json'}],\n", - " 'tool_call_chunks': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'args': '{\"query\": \"weather in san francisco\"}',\n", - " 'name': 'tavily_search_results_json',\n", - " 'index': 0}],\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {},\n", - " 'invalid_tool_calls': []}},\n", - " 'metadata': {'graph_id': 'agent',\n", - " 'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", - " 'created_by': 'system',\n", - " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca',\n", - " 'ls_model_type': 'chat'},\n", - " 'tags': ['seq:step:1']},\n", - " {'event_id': 'cf90f755-5a12-46bd-8f60-adc862388635',\n", - " 'run_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'received_at': '2024-05-18T00:50:27.873602+00:00',\n", - " 'span_id': '4885d5a0-cd89-4f00-8558-e85b542a710c',\n", - " 'event': 'on_chat_model_start',\n", - " 'name': 'ChatAnthropic',\n", - " 'data': {'input': {'messages': [[{'id': None,\n", - " 'name': None,\n", - " 'type': 'human',\n", - " 'content': 'what's the weather in sf',\n", - " 'example': False,\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {}}]]}},\n", - " 'metadata': {'graph_id': 'agent',\n", - " 'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", - " 'created_by': 'system',\n", - " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca',\n", - " 'ls_model_type': 'chat'},\n", - " 'tags': ['seq:step:1']}]" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], + "execution_count": 8, + "id": "3639da3c-bfe5-454c-ab1e-8ed7af394dfe", + "metadata": {}, + "outputs": [], "source": [ - "# We can list events for the run\n", - "await client.runs.list_events(thread['thread_id'], run['run_id'])" + "# Wait until the run finishes\n", + "await client.runs.join(thread['thread_id'], run['run_id'])" ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 9, "id": "8fa206ed-515e-4607-9a80-bebafe76cc24", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'run_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", + "{'run_id': '1ef2fdea-814c-6165-8b2a-a40e2a028198',\n", + " 'thread_id': '5fc20631-47b7-48cd-8aa2-9f2eace9778d',\n", " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca',\n", - " 'created_at': '2024-05-18T00:50:27.618761+00:00',\n", - " 'updated_at': '2024-05-18T00:50:27.618761+00:00',\n", + " 'created_at': '2024-06-21T14:58:02.095911+00:00',\n", + " 'updated_at': '2024-06-21T14:58:02.095911+00:00',\n", + " 'metadata': {},\n", " 'status': 'success',\n", - " 'metadata': {}}" + " 'kwargs': {'input': {'messages': [{'role': 'human',\n", + " 'content': 'what's the weather in sf'}]},\n", + " 'config': {'metadata': {'created_by': 'system'},\n", + " 'configurable': {'run_id': '1ef2fdea-814c-6165-8b2a-a40e2a028198',\n", + " 'user_id': '',\n", + " 'graph_id': 'agent',\n", + " 'thread_id': '5fc20631-47b7-48cd-8aa2-9f2eace9778d',\n", + " 'thread_ts': None,\n", + " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca'}},\n", + " 'webhook': None,\n", + " 'temporary': False,\n", + " 'stream_mode': ['events'],\n", + " 'feedback_keys': None,\n", + " 'interrupt_after': None,\n", + " 'interrupt_before': None},\n", + " 'multitask_strategy': 'reject'}" ] }, - "execution_count": 15, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -482,86 +225,114 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 10, "id": "8de4495f-7873-487c-b1a8-ad2a78a1ff35", "metadata": {}, "outputs": [], "source": [ "# We can get the final results\n", - "results = await client.runs.list_events(thread['thread_id'], run['run_id'])" + "final_result = await client.threads.get_state(thread['thread_id'])" ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 11, "id": "9da76fce-66e4-4f1b-8c24-09759889e50e", "metadata": {}, - "outputs": [], - "source": [ - "# The results are sorted by time, so the most recent (final) step is the 0 index\n", - "final_result = results[0]" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "02279ff3-c153-4ec4-be4d-1613a0dff4ee", - "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'event_id': '1af2076e-8ec7-4f2e-bc2c-6fbbf586397c',\n", - " 'run_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'received_at': '2024-05-18T00:50:35.557925+00:00',\n", - " 'span_id': 'e843abcb-e478-421b-91e1-a8ae171b14f4',\n", - " 'event': 'on_chain_end',\n", - " 'name': 'LangGraph',\n", - " 'data': {'output': {'messages': [{'id': '46b31c3a-01bf-4946-bd5a-fa6a7f6c97ce',\n", - " 'name': None,\n", - " 'type': 'human',\n", - " 'content': 'what's the weather in sf',\n", - " 'example': False,\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {}},\n", - " {'id': 'run-4885d5a0-cd89-4f00-8558-e85b542a710c',\n", - " 'name': None,\n", - " 'type': 'ai',\n", - " 'content': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'name': 'tavily_search_results_json',\n", - " 'type': 'tool_use',\n", - " 'input': {'query': 'weather in san francisco'}}],\n", - " 'example': False,\n", - " 'tool_calls': [{'id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'args': {'query': 'weather in san francisco'},\n", - " 'name': 'tavily_search_results_json'}],\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {},\n", - " 'invalid_tool_calls': []},\n", - " {'id': '045e936d-ee47-4236-95ff-793b6b32b590',\n", - " 'name': 'tavily_search_results_json',\n", - " 'type': 'tool',\n", - " 'content': '[{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{\\'location\\': {\\'name\\': \\'San Francisco\\', \\'region\\': \\'California\\', \\'country\\': \\'United States of America\\', \\'lat\\': 37.78, \\'lon\\': -122.42, \\'tz_id\\': \\'America/Los_Angeles\\', \\'localtime_epoch\\': 1715993410, \\'localtime\\': \\'2024-05-17 17:50\\'}, \\'current\\': {\\'last_updated_epoch\\': 1715993100, \\'last_updated\\': \\'2024-05-17 17:45\\', \\'temp_c\\': 17.8, \\'temp_f\\': 64.0, \\'is_day\\': 1, \\'condition\\': {\\'text\\': \\'Partly cloudy\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/day/116.png\\', \\'code\\': 1003}, \\'wind_mph\\': 15.0, \\'wind_kph\\': 24.1, \\'wind_degree\\': 300, \\'wind_dir\\': \\'WNW\\', \\'pressure_mb\\': 1013.0, \\'pressure_in\\': 29.9, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 65, \\'cloud\\': 25, \\'feelslike_c\\': 17.8, \\'feelslike_f\\': 64.0, \\'vis_km\\': 16.0, \\'vis_miles\\': 9.0, \\'uv\\': 5.0, \\'gust_mph\\': 16.2, \\'gust_kph\\': 26.1}}\"}]',\n", - " 'tool_call_id': 'toolu_018yyEfJHihdVfWypRNLqDug',\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {}},\n", - " {'id': 'run-069f1ddd-64b3-451d-bb84-75dec23a7286',\n", - " 'name': None,\n", - " 'type': 'ai',\n", - " 'content': \"The search results provide the current weather conditions in San Francisco. According to the data, as of 5:45pm on May 17, 2024, the weather in San Francisco is partly cloudy with a temperature of around 64°F (17.8°C). The wind is blowing from the west-northwest at 15 mph (24 km/h) with gusts up to 16 mph (26 km/h). The humidity is 65% and visibility is 9 miles (16 km). The UV index is 5.\\n\\nSo in summary, it's a partly cloudy spring day in San Francisco with mild temperatures and moderate winds. The weather seems pleasant for being outdoors during the daytime hours.\",\n", - " 'example': False,\n", - " 'tool_calls': [],\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {},\n", - " 'invalid_tool_calls': []}]}},\n", - " 'metadata': {'graph_id': 'agent',\n", - " 'thread_id': '6ada015b-b47a-4c4f-a5cd-580893cb6d0c',\n", + "{'values': {'messages': [{'content': 'what's the weather in sf',\n", + " 'additional_kwargs': {},\n", + " 'response_metadata': {},\n", + " 'type': 'human',\n", + " 'name': None,\n", + " 'id': 'bfe07fff-cb40-40be-84d5-a061d2c40006',\n", + " 'example': False},\n", + " {'content': [{'id': 'toolu_01QUzhhfDQkpbPSediUrXvQb',\n", + " 'input': {'query': 'weather in san francisco'},\n", + " 'name': 'tavily_search_results_json',\n", + " 'type': 'tool_use'}],\n", + " 'additional_kwargs': {},\n", + " 'response_metadata': {},\n", + " 'type': 'ai',\n", + " 'name': None,\n", + " 'id': 'run-6d8665ca-a77d-4b44-9a7b-4e975b155fb1',\n", + " 'example': False,\n", + " 'tool_calls': [{'name': 'tavily_search_results_json',\n", + " 'args': {'query': 'weather in san francisco'},\n", + " 'id': 'toolu_01QUzhhfDQkpbPSediUrXvQb'}],\n", + " 'invalid_tool_calls': [],\n", + " 'usage_metadata': None},\n", + " {'content': '[{\"url\": \"https://www.timeanddate.com/weather/usa/san-francisco/historic\", \"content\": \"San Francisco Weather History for the Previous 24 Hours Show weather for: Previous 24 hours June 17, 2024 June 16, 2024 June 15, 2024 June 14, 2024 June 13, 2024 June 12, 2024 June 11, 2024 June 10, 2024 June 9, 2024 June 8, 2024 June 7, 2024 June 6, 2024 June 5, 2024 June 4, 2024 June 3, 2024 June 2, 2024\"}]',\n", + " 'additional_kwargs': {},\n", + " 'response_metadata': {},\n", + " 'type': 'tool',\n", + " 'name': 'tavily_search_results_json',\n", + " 'id': '257a1f29-2f66-4f9e-b35d-c8818dbbaa3f',\n", + " 'tool_call_id': 'toolu_01QUzhhfDQkpbPSediUrXvQb'},\n", + " {'content': [{'text': 'The search results provide historic weather data for San Francisco, but do not give the current weather conditions. To get the current weather forecast for San Francisco, I would need to refine my search query. Here is an updated search:',\n", + " 'type': 'text'},\n", + " {'id': 'toolu_01RLJEcWYRvRoBhiHdrhoRZx',\n", + " 'input': {'query': 'san francisco weather forecast today'},\n", + " 'name': 'tavily_search_results_json',\n", + " 'type': 'tool_use'}],\n", + " 'additional_kwargs': {},\n", + " 'response_metadata': {},\n", + " 'type': 'ai',\n", + " 'name': None,\n", + " 'id': 'run-ca41dbf8-7e89-4ff2-a245-87098d7928ba',\n", + " 'example': False,\n", + " 'tool_calls': [{'name': 'tavily_search_results_json',\n", + " 'args': {'query': 'san francisco weather forecast today'},\n", + " 'id': 'toolu_01RLJEcWYRvRoBhiHdrhoRZx'}],\n", + " 'invalid_tool_calls': [],\n", + " 'usage_metadata': None},\n", + " {'content': '[{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{\\'location\\': {\\'name\\': \\'San Francisco\\', \\'region\\': \\'California\\', \\'country\\': \\'United States of America\\', \\'lat\\': 37.78, \\'lon\\': -122.42, \\'tz_id\\': \\'America/Los_Angeles\\', \\'localtime_epoch\\': 1718981382, \\'localtime\\': \\'2024-06-21 7:49\\'}, \\'current\\': {\\'last_updated_epoch\\': 1718981100, \\'last_updated\\': \\'2024-06-21 07:45\\', \\'temp_c\\': 12.8, \\'temp_f\\': 55.0, \\'is_day\\': 1, \\'condition\\': {\\'text\\': \\'Overcast\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/day/122.png\\', \\'code\\': 1009}, \\'wind_mph\\': 6.9, \\'wind_kph\\': 11.2, \\'wind_degree\\': 200, \\'wind_dir\\': \\'SSW\\', \\'pressure_mb\\': 1011.0, \\'pressure_in\\': 29.84, \\'precip_mm\\': 0.01, \\'precip_in\\': 0.0, \\'humidity\\': 86, \\'cloud\\': 100, \\'feelslike_c\\': 12.2, \\'feelslike_f\\': 53.9, \\'windchill_c\\': 11.2, \\'windchill_f\\': 52.1, \\'heatindex_c\\': 12.0, \\'heatindex_f\\': 53.5, \\'dewpoint_c\\': 9.4, \\'dewpoint_f\\': 48.8, \\'vis_km\\': 16.0, \\'vis_miles\\': 9.0, \\'uv\\': 3.0, \\'gust_mph\\': 7.6, \\'gust_kph\\': 12.2}}\"}]',\n", + " 'additional_kwargs': {},\n", + " 'response_metadata': {},\n", + " 'type': 'tool',\n", + " 'name': 'tavily_search_results_json',\n", + " 'id': 'c80a3720-6a9f-4ff0-9ce2-6112e66a6f81',\n", + " 'tool_call_id': 'toolu_01RLJEcWYRvRoBhiHdrhoRZx'},\n", + " {'content': 'The updated search provides the current weather forecast for San Francisco. According to the results, as of 7:49am on June 21, 2024 in San Francisco, the temperature is 55°F (12.8°C), it is overcast with 100% cloud cover, and there are light winds from the south-southwest around 7 mph (11 km/h). The forecast also shows low precipitation of 0.01 mm, high humidity of 86%, and visibility of 9 miles (16 km).\\n\\nIn summary, the current weather in San Francisco is cool, overcast, and breezy based on this weather forecast data. Let me know if you need any other details!',\n", + " 'additional_kwargs': {},\n", + " 'response_metadata': {},\n", + " 'type': 'ai',\n", + " 'name': None,\n", + " 'id': 'run-4f23b53d-a8ec-4038-b3ed-08b2560bf81c',\n", + " 'example': False,\n", + " 'tool_calls': [],\n", + " 'invalid_tool_calls': [],\n", + " 'usage_metadata': None}]},\n", + " 'next': [],\n", + " 'config': {'configurable': {'thread_id': '5fc20631-47b7-48cd-8aa2-9f2eace9778d',\n", + " 'thread_ts': '1ef2fdea-f879-65a5-8005-443b6a4039aa'}},\n", + " 'metadata': {'step': 5,\n", + " 'run_id': '1ef2fdea-814c-6165-8b2a-a40e2a028198',\n", + " 'source': 'loop',\n", + " 'writes': {'agent': {'messages': [{'id': 'run-4f23b53d-a8ec-4038-b3ed-08b2560bf81c',\n", + " 'name': None,\n", + " 'type': 'ai',\n", + " 'content': 'The updated search provides the current weather forecast for San Francisco. According to the results, as of 7:49am on June 21, 2024 in San Francisco, the temperature is 55°F (12.8°C), it is overcast with 100% cloud cover, and there are light winds from the south-southwest around 7 mph (11 km/h). The forecast also shows low precipitation of 0.01 mm, high humidity of 86%, and visibility of 9 miles (16 km).\\n\\nIn summary, the current weather in San Francisco is cool, overcast, and breezy based on this weather forecast data. Let me know if you need any other details!',\n", + " 'example': False,\n", + " 'tool_calls': [],\n", + " 'usage_metadata': None,\n", + " 'additional_kwargs': {},\n", + " 'response_metadata': {},\n", + " 'invalid_tool_calls': []}]}},\n", + " 'user_id': '',\n", + " 'graph_id': 'agent',\n", + " 'thread_id': '5fc20631-47b7-48cd-8aa2-9f2eace9778d',\n", " 'created_by': 'system',\n", " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca'},\n", - " 'tags': []}" + " 'created_at': '2024-06-21T14:58:14.591805+00:00',\n", + " 'parent_config': {'configurable': {'thread_id': '5fc20631-47b7-48cd-8aa2-9f2eace9778d',\n", + " 'thread_ts': '1ef2fdea-d44c-6fc4-8004-d2713436777d'}}}" ] }, - "execution_count": 22, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -572,40 +343,32 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 12, "id": "ddd6e698-4609-4389-b84a-bb8939fff08b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "\"The search results provide the current weather conditions in San Francisco. According to the data, as of 5:45pm on May 17, 2024, the weather in San Francisco is partly cloudy with a temperature of around 64°F (17.8°C). The wind is blowing from the west-northwest at 15 mph (24 km/h) with gusts up to 16 mph (26 km/h). The humidity is 65% and visibility is 9 miles (16 km). The UV index is 5.\\n\\nSo in summary, it's a partly cloudy spring day in San Francisco with mild temperatures and moderate winds. The weather seems pleasant for being outdoors during the daytime hours.\"" + "'The updated search provides the current weather forecast for San Francisco. According to the results, as of 7:49am on June 21, 2024 in San Francisco, the temperature is 55°F (12.8°C), it is overcast with 100% cloud cover, and there are light winds from the south-southwest around 7 mph (11 km/h). The forecast also shows low precipitation of 0.01 mm, high humidity of 86%, and visibility of 9 miles (16 km).\\n\\nIn summary, the current weather in San Francisco is cool, overcast, and breezy based on this weather forecast data. Let me know if you need any other details!'" ] }, - "execution_count": 28, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# We can get the content of the final message\n", - "final_result['data']['output']['messages'][-1]['content']" + "final_result['values']['messages'][-1]['content']" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "535638f7-48a9-49bb-9a0b-57a5b36d0696", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "langgraph-example-dev", "language": "python", - "name": "python3" + "name": "langgraph-example-dev" }, "language_info": { "codemirror_mode": { @@ -617,7 +380,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.1" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/examples/cloud_examples/enqueue_concurrent.ipynb b/examples/cloud_examples/enqueue_concurrent.ipynb index ca33148f7..61c76e6f8 100644 --- a/examples/cloud_examples/enqueue_concurrent.ipynb +++ b/examples/cloud_examples/enqueue_concurrent.ipynb @@ -28,7 +28,7 @@ "outputs": [], "source": [ "client = get_client()\n", - "assistant = await client.assistants.create(\"agent\")\n", + "assistant_id = \"agent\"\n", "thread = await client.threads.create()" ] }, @@ -41,7 +41,7 @@ "# this run will be interrupted\n", "first_run = await client.runs.create(\n", " thread[\"thread_id\"],\n", - " assistant[\"assistant_id\"],\n", + " assistant_id,\n", " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in sf?\"}]},\n", ")" ] @@ -54,7 +54,7 @@ "source": [ "second_run = await client.runs.create(\n", " thread[\"thread_id\"],\n", - " assistant[\"assistant_id\"],\n", + " assistant_id,\n", " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in nyc?\"}]},\n", " multitask_strategy=\"enqueue\",\n", ")" @@ -175,10 +175,14 @@ } ], "metadata": { + "kernelspec": { + "display_name": "", + "name": "" + }, "language_info": { "name": "python" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/cloud_examples/human-in-the-loop_cloud.ipynb b/examples/cloud_examples/human-in-the-loop_cloud.ipynb index 475e6b66d..40f0bc116 100644 --- a/examples/cloud_examples/human-in-the-loop_cloud.ipynb +++ b/examples/cloud_examples/human-in-the-loop_cloud.ipynb @@ -35,35 +35,6 @@ "client = get_client()" ] }, - { - "cell_type": "code", - "execution_count": 3, - "id": "4947e9bc-111f-4991-8c41-1041da9bf0ba", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[{'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca',\n", - " 'graph_id': 'agent',\n", - " 'config': {},\n", - " 'created_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'updated_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'metadata': {'created_by': 'system'}}]" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# There should always be a default assistant with no configuration\n", - "assistants = await client.assistants.search()\n", - "assistants = [a for a in assistants if not a['config']]\n", - "assistants" - ] - }, { "cell_type": "code", "execution_count": 4, @@ -87,8 +58,7 @@ } ], "source": [ - "assistant = assistants[0]\n", - "assistant" + "assistant_id = \"agent\"" ] }, { @@ -188,7 +158,7 @@ "source": [ "input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in sf\"}]}\n", "async for chunk in client.runs.stream(\n", - " thread['thread_id'], assistant['assistant_id'], input=input, stream_mode=\"updates\", interrupt_before=['action']\n", + " thread['thread_id'], assistant_id, input=input, stream_mode=\"updates\", interrupt_before=['action']\n", "):\n", " print(f\"Receiving new event of type: {chunk.event}...\")\n", " print(chunk.data)\n", @@ -239,7 +209,7 @@ "source": [ "input = None\n", "async for chunk in client.runs.stream(\n", - " thread['thread_id'], assistant['assistant_id'], input=input, stream_mode=\"updates\", interrupt_before=['action']\n", + " thread['thread_id'], assistant_id, input=input, stream_mode=\"updates\", interrupt_before=['action']\n", "):\n", " print(f\"Receiving new event of type: {chunk.event}...\")\n", " print(chunk.data)\n", @@ -289,7 +259,7 @@ "source": [ "input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in la?\"}]}\n", "async for chunk in client.runs.stream(\n", - " thread['thread_id'], assistant['assistant_id'], input=input, stream_mode=\"updates\", interrupt_before=['action']\n", + " thread['thread_id'], assistant_id, input=input, stream_mode=\"updates\", interrupt_before=['action']\n", "):\n", " print(f\"Receiving new event of type: {chunk.event}...\")\n", " print(chunk.data)\n", @@ -492,7 +462,7 @@ "source": [ "input = None\n", "async for chunk in client.runs.stream(\n", - " thread['thread_id'], assistant['assistant_id'], input=input, stream_mode=\"updates\", interrupt_before=['action']\n", + " thread['thread_id'], assistant_id, input=input, stream_mode=\"updates\", interrupt_before=['action']\n", "):\n", " print(f\"Receiving new event of type: {chunk.event}...\")\n", " print(chunk.data)\n", @@ -641,7 +611,7 @@ "input = None\n", "async for chunk in client.runs.stream(\n", " thread['thread_id'], \n", - " assistant['assistant_id'], \n", + " assistant_id, \n", " input=input, \n", " stream_mode=\"updates\", \n", " interrupt_before=['action'],\n", @@ -677,7 +647,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.1" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/examples/cloud_examples/interrupt_concurrent.ipynb b/examples/cloud_examples/interrupt_concurrent.ipynb index 9fd839ab0..c142bcd17 100644 --- a/examples/cloud_examples/interrupt_concurrent.ipynb +++ b/examples/cloud_examples/interrupt_concurrent.ipynb @@ -30,7 +30,7 @@ "outputs": [], "source": [ "client = get_client()\n", - "assistant = await client.assistants.create(\"agent\")\n", + "assistant_id = \"agent\"\n", "thread = await client.threads.create()" ] }, @@ -43,13 +43,13 @@ "# the first run will be interrupted\n", "interrupted_run = await client.runs.create(\n", " thread[\"thread_id\"],\n", - " assistant[\"assistant_id\"],\n", + " assistant_id,\n", " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in sf?\"}]},\n", ")\n", "await asyncio.sleep(2)\n", "run = await client.runs.create(\n", " thread[\"thread_id\"],\n", - " assistant[\"assistant_id\"],\n", + " assistant_id,\n", " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in nyc?\"}]},\n", " multitask_strategy=\"interrupt\",\n", ")" @@ -166,10 +166,14 @@ } ], "metadata": { + "kernelspec": { + "display_name": "", + "name": "" + }, "language_info": { "name": "python" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/cloud_examples/reject_concurrent.ipynb b/examples/cloud_examples/reject_concurrent.ipynb index cdbc261f4..866385680 100644 --- a/examples/cloud_examples/reject_concurrent.ipynb +++ b/examples/cloud_examples/reject_concurrent.ipynb @@ -28,24 +28,8 @@ "metadata": {}, "outputs": [], "source": [ - "client = get_client()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "assistant = await client.assistants.create(\"agent\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ + "client = get_client()\n", + "assistant_id = \"agent\"\n", "thread = await client.threads.create()" ] }, @@ -57,7 +41,7 @@ "source": [ "run = await client.runs.create(\n", " thread[\"thread_id\"],\n", - " assistant[\"assistant_id\"],\n", + " assistant_id,\n", " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in sf?\"}]},\n", ")" ] @@ -80,7 +64,7 @@ "try:\n", " await client.runs.create(\n", " thread[\"thread_id\"],\n", - " assistant[\"assistant_id\"],\n", + " assistant_id,\n", " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in nyc?\"}]},\n", " multitask_strategy=\"reject\",\n", " )\n", @@ -163,10 +147,14 @@ } ], "metadata": { + "kernelspec": { + "display_name": "", + "name": "" + }, "language_info": { "name": "python" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/cloud_examples/rollback_concurrent.ipynb b/examples/cloud_examples/rollback_concurrent.ipynb index 734f299c4..3c24fb273 100644 --- a/examples/cloud_examples/rollback_concurrent.ipynb +++ b/examples/cloud_examples/rollback_concurrent.ipynb @@ -31,7 +31,7 @@ "outputs": [], "source": [ "client = get_client()\n", - "assistant = await client.assistants.create(\"agent\")\n", + "assistant_id = \"agent\"\n", "thread = await client.threads.create()" ] }, @@ -44,13 +44,13 @@ "# the first run will be interrupted\n", "rolled_back_run = await client.runs.create(\n", " thread[\"thread_id\"],\n", - " assistant[\"assistant_id\"],\n", + " assistant_id,\n", " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in sf?\"}]},\n", ")\n", "await asyncio.sleep(2)\n", "run = await client.runs.create(\n", " thread[\"thread_id\"],\n", - " assistant[\"assistant_id\"],\n", + " assistant_id,\n", " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in nyc?\"}]},\n", " multitask_strategy=\"rollback\",\n", ")" @@ -146,10 +146,14 @@ } ], "metadata": { + "kernelspec": { + "display_name": "", + "name": "" + }, "language_info": { "name": "python" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/cloud_examples/stream_messages.ipynb b/examples/cloud_examples/stream_messages.ipynb index 28883c655..8502f7b4c 100644 --- a/examples/cloud_examples/stream_messages.ipynb +++ b/examples/cloud_examples/stream_messages.ipynb @@ -63,51 +63,25 @@ "metadata": {}, "outputs": [], "source": [ - "assistant = await client.assistants.create(graph_id=\"agent\", config={\"configurable\": {\"model_name\": \"openai\"}})" + "assistant_id = \"agent\"" ] }, { "cell_type": "code", "execution_count": 4, - "id": "4947e9bc-111f-4991-8c41-1041da9bf0ba", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'assistant_id': 'e6de0bea-86b1-4902-a20b-1f60caf24ef9',\n", - " 'graph_id': 'agent',\n", - " 'config': {'configurable': {'model_name': 'openai'}},\n", - " 'created_at': '2024-05-18T19:58:45.145734+00:00',\n", - " 'updated_at': '2024-05-18T19:58:45.145734+00:00',\n", - " 'metadata': {}}" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "assistant" - ] - }, - { - "cell_type": "code", - "execution_count": 43, "id": "56aa5159-5583-4134-9210-709b969bda6f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'thread_id': 'd7d3507f-8242-4705-ae6a-2bf45aefe38c',\n", - " 'created_at': '2024-05-18T20:14:05.504749+00:00',\n", - " 'updated_at': '2024-05-18T20:14:05.504749+00:00',\n", + "{'thread_id': 'e1431c95-e241-4d1d-a252-27eceb1e5c86',\n", + " 'created_at': '2024-06-21T15:48:59.808924+00:00',\n", + " 'updated_at': '2024-06-21T15:48:59.808924+00:00',\n", " 'metadata': {}}" ] }, - "execution_count": 43, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -119,7 +93,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 5, "id": "147c3f98-f889-4f05-a090-6b31f2a0b291", "metadata": {}, "outputs": [ @@ -129,7 +103,7 @@ "[]" ] }, - "execution_count": 44, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -141,7 +115,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 6, "id": "040795c6-5d9f-4729-9132-f3b0f94d9e94", "metadata": {}, "outputs": [], @@ -159,7 +133,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 7, "id": "7da70e20-1a4e-4df2-b996-1927f474c835", "metadata": {}, "outputs": [ @@ -167,51 +141,42 @@ "name": "stdout", "output_type": "stream", "text": [ - "Metadata: Run ID - c64b3e27-c7a4-4851-9618-07641fa24296\n", - "--------------------------------------------------\n", - "Human: what's the weather in sf\n", + "Metadata: Run ID - 1ef2fe5c-6a1d-6575-bc09-d7832711c17e\n", "--------------------------------------------------\n", "Invalid Tool Calls:\n", - "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: \n", + "Tool Call ID: call_cg14F20jMBqWYrNgEkdWHwB3, Function: tavily_search_results_json, Arguments: \n", "--------------------------------------------------\n", "Tool Calls:\n", - "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {}\n", + "Tool Call ID: call_cg14F20jMBqWYrNgEkdWHwB3, Function: tavily_search_results_json, Arguments: {}\n", "--------------------------------------------------\n", "Tool Calls:\n", - "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {}\n", + "Tool Call ID: call_cg14F20jMBqWYrNgEkdWHwB3, Function: tavily_search_results_json, Arguments: {}\n", "--------------------------------------------------\n", "Tool Calls:\n", - "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': ''}\n", + "Tool Call ID: call_cg14F20jMBqWYrNgEkdWHwB3, Function: tavily_search_results_json, Arguments: {'query': ''}\n", "--------------------------------------------------\n", "Tool Calls:\n", - "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current'}\n", + "Tool Call ID: call_cg14F20jMBqWYrNgEkdWHwB3, Function: tavily_search_results_json, Arguments: {'query': 'current'}\n", "--------------------------------------------------\n", "Tool Calls:\n", - "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather'}\n", + "Tool Call ID: call_cg14F20jMBqWYrNgEkdWHwB3, Function: tavily_search_results_json, Arguments: {'query': 'current weather'}\n", "--------------------------------------------------\n", "Tool Calls:\n", - "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in'}\n", + "Tool Call ID: call_cg14F20jMBqWYrNgEkdWHwB3, Function: tavily_search_results_json, Arguments: {'query': 'current weather in'}\n", "--------------------------------------------------\n", "Tool Calls:\n", - "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San'}\n", + "Tool Call ID: call_cg14F20jMBqWYrNgEkdWHwB3, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San'}\n", "--------------------------------------------------\n", "Tool Calls:\n", - "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San Francisco'}\n", + "Tool Call ID: call_cg14F20jMBqWYrNgEkdWHwB3, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San Francisco'}\n", "--------------------------------------------------\n", "Tool Calls:\n", - "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San Francisco'}\n", + "Tool Call ID: call_cg14F20jMBqWYrNgEkdWHwB3, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San Francisco'}\n", "--------------------------------------------------\n", "Tool Calls:\n", - "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San Francisco'}\n", + "Tool Call ID: call_cg14F20jMBqWYrNgEkdWHwB3, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San Francisco'}\n", "Response Metadata: Finish Reason - tool_calls\n", "--------------------------------------------------\n", - "AI: what's the weather in sf\n", - "Tool Calls:\n", - "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San Francisco'}\n", - "Response Metadata: Finish Reason - tool_calls\n", - "--------------------------------------------------\n", - "AI: [{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{'location': {'name': 'San Francisco', 'region': 'California', 'country': 'United States of America', 'lat': 37.78, 'lon': -122.42, 'tz_id': 'America/Los_Angeles', 'localtime_epoch': 1716063227, 'localtime': '2024-05-18 13:13'}, 'current': {'last_updated_epoch': 1716062400, 'last_updated': '2024-05-18 13:00', 'temp_c': 17.2, 'temp_f': 63.0, 'is_day': 1, 'condition': {'text': 'Partly cloudy', 'icon': '//cdn.weatherapi.com/weather/64x64/day/116.png', 'code': 1003}, 'wind_mph': 2.2, 'wind_kph': 3.6, 'wind_degree': 237, 'wind_dir': 'WSW', 'pressure_mb': 1015.0, 'pressure_in': 29.98, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 65, 'cloud': 50, 'feelslike_c': 17.2, 'feelslike_f': 63.0, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 5.0, 'gust_mph': 13.8, 'gust_kph': 22.3}}\"}]\n", - "--------------------------------------------------\n", "--------------------------------------------------\n", "AI: The\n", "--------------------------------------------------\n", @@ -227,1129 +192,151 @@ "--------------------------------------------------\n", "AI: The current weather in San Francisco is\n", "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "-\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:**\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** \n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "-\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:**\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Part\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "-\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:**\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** \n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 k\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph)\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the W\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "-\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:**\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** \n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "-\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:**\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** \n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "-\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:**\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** \n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 101\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "-\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:**\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** \n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "-\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **G\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gust\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:**\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to \n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 k\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Part\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weather\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi.com\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi.com/weather\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi.com/weather/\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi.com/weather/64\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi.com/weather/64x\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi.com/weather/64x64\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day/\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day/116\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day/116.png\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day/116.png)\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day/116.png)\n", + "AI: The current weather in San Francisco is over\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of \n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F).\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-s\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-south\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at \n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 k\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph).\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at \n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%,\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is \n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16 km\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16 km (\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16 km (9\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16 km (9 miles\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16 km (9 miles).\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16 km (9 miles). The\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16 km (9 miles). The UV\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16 km (9 miles). The UV index\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16 km (9 miles). The UV index is\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16 km (9 miles). The UV index is \n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16 km (9 miles). The UV index is 3\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16 km (9 miles). The UV index is 3.\n", + "--------------------------------------------------\n", + "AI: The current weather in San Francisco is overcast with a temperature of 13.9°C (57.0°F). The wind is blowing from the south-southwest at 6.9 mph (11.2 kph). The humidity is at 81%, and the visibility is 16 km (9 miles). The UV index is 3.\n", "Response Metadata: Finish Reason - stop\n", - "--------------------------------------------------\n", - "AI: The current weather in San Francisco is as follows:\n", - "\n", - "- **Temperature:** 17.2°C (63.0°F)\n", - "- **Condition:** Partly cloudy\n", - "- **Wind:** 2.2 mph (3.6 kph) from the WSW\n", - "- **Humidity:** 65%\n", - "- **Visibility:** 16 km (9 miles)\n", - "- **Pressure:** 1015.0 mb (29.98 in)\n", - "- **UV Index:** 5\n", - "- **Gusts:** Up to 13.8 mph (22.3 kph)\n", - "\n", - "![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day/116.png)\n", - "Response Metadata: Finish Reason - stop\n", - "--------------------------------------------------\n", "--------------------------------------------------\n" ] } ], "source": [ "input = {\"messages\": [{\"role\": \"user\", \"content\": \"what's the weather in sf\"}]}\n", + "config = {\"configurable\": {\"model_name\": \"openai\"}}\n", "\n", - "async for event in client.runs.stream(thread['thread_id'], assistant['assistant_id'], input=input, stream_mode='messages'):\n", + "async for event in client.runs.stream(thread['thread_id'], assistant_id, input=input, config=config, stream_mode='messages'):\n", " if event.event == 'metadata':\n", " print(f\"Metadata: Run ID - {event.data['run_id']}\")\n", - " elif event.event == 'data':\n", + " print(\"-\" * 50)\n", + " elif event.event == 'messages/partial':\n", " for data_item in event.data:\n", " if 'role' in data_item and data_item['role'] == 'user':\n", " print(f\"Human: {data_item['content']}\")\n", @@ -1373,16 +360,16 @@ " if response_metadata:\n", " finish_reason = response_metadata.get('finish_reason', 'N/A')\n", " print(f\"Response Metadata: Finish Reason - {finish_reason}\")\n", - " print(\"-\" * 50)\n", + " print(\"-\" * 50)\n", " " ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "langgraph-example-dev", "language": "python", - "name": "python3" + "name": "langgraph-example-dev" }, "language_info": { "codemirror_mode": { @@ -1394,7 +381,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.1" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/examples/cloud_examples/stream_updates.ipynb b/examples/cloud_examples/stream_updates.ipynb index 4c5a77bf4..970e7b71b 100644 --- a/examples/cloud_examples/stream_updates.ipynb +++ b/examples/cloud_examples/stream_updates.ipynb @@ -40,75 +40,29 @@ { "cell_type": "code", "execution_count": 3, - "id": "4947e9bc-111f-4991-8c41-1041da9bf0ba", + "id": "230c0464-a6e5-420f-9e38-ca514e5634ce", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[{'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca',\n", - " 'graph_id': 'agent',\n", - " 'config': {},\n", - " 'created_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'updated_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'metadata': {'created_by': 'system'}}]" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "# There should always be a default assistant with no configuration\n", - "assistants = await client.assistants.search()\n", - "assistants = [a for a in assistants if not a['config']]\n", - "assistants" + "assistant_id = \"agent\"" ] }, { "cell_type": "code", "execution_count": 4, - "id": "230c0464-a6e5-420f-9e38-ca514e5634ce", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca',\n", - " 'graph_id': 'agent',\n", - " 'config': {},\n", - " 'created_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'updated_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'metadata': {'created_by': 'system'}}" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "assistant = assistants[0]\n", - "assistant" - ] - }, - { - "cell_type": "code", - "execution_count": 5, "id": "56aa5159-5583-4134-9210-709b969bda6f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'thread_id': '1eee9bd4-ec61-4300-a38a-2e13b8925d39',\n", - " 'created_at': '2024-05-18T19:57:36.509105+00:00',\n", - " 'updated_at': '2024-05-18T19:57:36.509105+00:00',\n", + "{'thread_id': '979e3c89-a702-4882-87c2-7a59a250ce16',\n", + " 'created_at': '2024-06-21T15:22:07.453100+00:00',\n", + " 'updated_at': '2024-06-21T15:22:07.453100+00:00',\n", " 'metadata': {}}" ] }, - "execution_count": 5, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -120,7 +74,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "id": "147c3f98-f889-4f05-a090-6b31f2a0b291", "metadata": {}, "outputs": [ @@ -130,7 +84,7 @@ "[]" ] }, - "execution_count": 6, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -180,7 +134,7 @@ ], "source": [ "input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in la\"}]}\n", - "async for chunk in client.runs.stream(thread['thread_id'], assistant['assistant_id'], input=input, stream_mode=\"updates\", ):\n", + "async for chunk in client.runs.stream(thread['thread_id'], assistant_id, input=input, stream_mode=\"updates\", ):\n", " print(f\"Receiving new event of type: {chunk.event}...\")\n", " print(chunk.data)\n", " print(\"\\n\\n\")" @@ -211,7 +165,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.1" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/examples/cloud_examples/stream_values.ipynb b/examples/cloud_examples/stream_values.ipynb index f30b4fe6e..c71fec2e5 100644 --- a/examples/cloud_examples/stream_values.ipynb +++ b/examples/cloud_examples/stream_values.ipynb @@ -40,57 +40,11 @@ { "cell_type": "code", "execution_count": 3, - "id": "4947e9bc-111f-4991-8c41-1041da9bf0ba", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[{'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca',\n", - " 'graph_id': 'agent',\n", - " 'config': {},\n", - " 'created_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'updated_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'metadata': {'created_by': 'system'}}]" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# There should always be a default assistant with no configuration\n", - "assistants = await client.assistants.search()\n", - "assistants = [a for a in assistants if not a['config']]\n", - "assistants" - ] - }, - { - "cell_type": "code", - "execution_count": 4, "id": "230c0464-a6e5-420f-9e38-ca514e5634ce", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca',\n", - " 'graph_id': 'agent',\n", - " 'config': {},\n", - " 'created_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'updated_at': '2024-05-18T00:19:39.688822+00:00',\n", - " 'metadata': {'created_by': 'system'}}" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "assistant = assistants[0]\n", - "assistant" + "assistant_id = \"agent\"" ] }, { @@ -139,7 +93,7 @@ "source": [ "input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in la\"}]}\n", "thread = await client.threads.create()\n", - "async for chunk in client.runs.stream(thread['thread_id'], assistant['assistant_id'], input=input):\n", + "async for chunk in client.runs.stream(thread['thread_id'], assistant_id, input=input):\n", " print(f\"Receiving new event of type: {chunk.event}...\")\n", " print(chunk.data)\n", " print(\"\\n\\n\")" @@ -163,7 +117,7 @@ "input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in la\"}]}\n", "thread = await client.threads.create()\n", "final_answer = None\n", - "async for chunk in client.runs.stream(thread['thread_id'], assistant['assistant_id'], input=input):\n", + "async for chunk in client.runs.stream(thread['thread_id'], assistant_id, input=input):\n", " if chunk.event == \"values\":\n", " final_answer = chunk.data" ] @@ -250,7 +204,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.1" + "version": "3.11.9" } }, "nbformat": 4,