Files
langgraph/examples/cloud_examples/stream_messages.ipynb
T
Vadym BardaandGitHub f741fbf92e docs: run codespell on all notebooks (#736)
* run codespell on all notebooks

* fix codespell
2024-06-20 21:39:13 -04:00

58 KiB

How to stream messages from your graph

There are multiple different streaming modes.

  • values: This streaming mode streams back values of the graph. This is the full state of the graph after each node is called.
  • updates: This streaming mode streams back updates to the graph. This is the update to the state of the graph after each node is called.
  • messages: This streaming mode streams back messages - both complete messages (at the end of a node) as well as tokens for any messages generated inside a node. This mode is primarily meant for powering chat applications.

This notebook covers streaming_mode="messages".

In order to use this mode, the state of the graph you are interacting with MUST have a messages key that is a list of messages. Eg, the state should look something like:

from typing import TypedDict, Annotated
from langgraph.graph import add_messages
from langchain_core.messages import AnyMessage

class State(TypedDict):
    messages: Annotated[list[AnyMessage], add_messages]

OR it should be an instance or subclass of from langgraph.graph import MessageState (MessageState is just a helper type hint equivalent to the above).

With stream_mode="messages" two things will be streamed back:

  • It outputs messages produced by any chat model called inside (unless tagged in a special way)
  • It outputs messages returned from nodes (to allow for nodes to return ToolMessages and the like
In [1]:
from langgraph_sdk import get_client
In [2]:
client = get_client()
In [3]:
assistant = await client.assistants.create(graph_id="agent", config={"configurable": {"model_name": "openai"}})
In [4]:
assistant
Out [4]:
{'assistant_id': 'e6de0bea-86b1-4902-a20b-1f60caf24ef9',
 'graph_id': 'agent',
 'config': {'configurable': {'model_name': 'openai'}},
 'created_at': '2024-05-18T19:58:45.145734+00:00',
 'updated_at': '2024-05-18T19:58:45.145734+00:00',
 'metadata': {}}
In [43]:
thread = await client.threads.create()
thread
Out [43]:
{'thread_id': 'd7d3507f-8242-4705-ae6a-2bf45aefe38c',
 'created_at': '2024-05-18T20:14:05.504749+00:00',
 'updated_at': '2024-05-18T20:14:05.504749+00:00',
 'metadata': {}}
In [44]:
runs = await client.runs.list(thread['thread_id'])
runs
Out [44]:
[]
In [46]:
# Helper function for formatting messages

def format_tool_calls(tool_calls):
    if tool_calls:
        formatted_calls = []
        for call in tool_calls:
            formatted_calls.append(f"Tool Call ID: {call['id']}, Function: {call['name']}, Arguments: {call['args']}")
        return "\n".join(formatted_calls)
    return "No tool calls"
In [45]:
input = {"messages": [{"role": "user", "content": "what's the weather in sf"}]}

async for event in client.runs.stream(thread['thread_id'], assistant['assistant_id'], input=input, stream_mode='messages'):
    if event.event == 'metadata':
        print(f"Metadata: Run ID - {event.data['run_id']}")
    elif event.event == 'data':
        for data_item in event.data:
            if 'role' in data_item and data_item['role'] == 'user':
                print(f"Human: {data_item['content']}")
            else:
                tool_calls = data_item.get('tool_calls', [])
                invalid_tool_calls = data_item.get('invalid_tool_calls', [])
                content = data_item.get('content', "")
                response_metadata = data_item.get('response_metadata', {})

                if content:
                    print(f"AI: {content}")
                
                if tool_calls:
                    print("Tool Calls:")
                    print(format_tool_calls(tool_calls))
                
                if invalid_tool_calls:
                    print("Invalid Tool Calls:")
                    print(format_tool_calls(invalid_tool_calls))

                if response_metadata:
                    finish_reason = response_metadata.get('finish_reason', 'N/A')
                    print(f"Response Metadata: Finish Reason - {finish_reason}")
    print("-" * 50)
    
Metadata: Run ID - c64b3e27-c7a4-4851-9618-07641fa24296
--------------------------------------------------
Human: what's the weather in sf
--------------------------------------------------
Invalid Tool Calls:
Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: 
--------------------------------------------------
Tool Calls:
Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {}
--------------------------------------------------
Tool Calls:
Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {}
--------------------------------------------------
Tool Calls:
Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': ''}
--------------------------------------------------
Tool Calls:
Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current'}
--------------------------------------------------
Tool Calls:
Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather'}
--------------------------------------------------
Tool Calls:
Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in'}
--------------------------------------------------
Tool Calls:
Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San'}
--------------------------------------------------
Tool Calls:
Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San Francisco'}
--------------------------------------------------
Tool Calls:
Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San Francisco'}
--------------------------------------------------
Tool Calls:
Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San Francisco'}
Response Metadata: Finish Reason - tool_calls
--------------------------------------------------
AI: what's the weather in sf
Tool Calls:
Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San Francisco'}
Response Metadata: Finish Reason - tool_calls
--------------------------------------------------
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}}"}]
--------------------------------------------------
--------------------------------------------------
AI: The
--------------------------------------------------
AI: The current
--------------------------------------------------
AI: The current weather
--------------------------------------------------
AI: The current weather in
--------------------------------------------------
AI: The current weather in San
--------------------------------------------------
AI: The current weather in San Francisco
--------------------------------------------------
AI: The current weather in San Francisco is
--------------------------------------------------
AI: The current weather in San Francisco is as
--------------------------------------------------
AI: The current weather in San Francisco is as follows
--------------------------------------------------
AI: The current weather in San Francisco is as follows:


--------------------------------------------------
AI: The current weather in San Francisco is as follows:

-
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:**
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)

--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
-
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:**
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Part
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy

--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
-
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:**
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 k
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph)
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the W
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW

--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
-
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:**
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%

--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
-
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:**
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)

--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
-
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:**
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 101
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)

--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
-
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:**
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5

--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
-
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **G
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gust
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:**
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 k
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)


--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Part
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weather
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi.com
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi.com/weather
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi.com/weather/
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi.com/weather/64
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi.com/weather/64x
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi.com/weather/64x64
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day/
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day/116
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day/116.png
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day/116.png)
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day/116.png)
Response Metadata: Finish Reason - stop
--------------------------------------------------
AI: The current weather in San Francisco is as follows:

- **Temperature:** 17.2°C (63.0°F)
- **Condition:** Partly cloudy
- **Wind:** 2.2 mph (3.6 kph) from the WSW
- **Humidity:** 65%
- **Visibility:** 16 km (9 miles)
- **Pressure:** 1015.0 mb (29.98 in)
- **UV Index:** 5
- **Gusts:** Up to 13.8 mph (22.3 kph)

![Partly cloudy](//cdn.weatherapi.com/weather/64x64/day/116.png)
Response Metadata: Finish Reason - stop
--------------------------------------------------
--------------------------------------------------