L2 LangGraph_Components

news2025/2/24 18:57:07

参考自https://www.deeplearning.ai/short-courses/ai-agents-in-langgraph,以下为代码的实现。

  • 这里用LangGraph把L1的ReAct_Agent实现,可以看出用LangGraph流程化了很多。

LangGraph Components

import os
from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())
# print(os.environ.get('OPENAI_API_KEY'))
# print(os.environ.get('TAVILY_API_KEY'))
# print(os.environ.get('OPENAI_BASE_URL'))
from langgraph.graph import StateGraph, END
from typing import TypedDict, Annotated
import operator
from langchain_core.messages import AnyMessage, SystemMessage, HumanMessage, ToolMessage
from langchain_openai import ChatOpenAI
from langchain_community.tools.tavily_search import TavilySearchResults
tool = TavilySearchResults(max_results=2) #increased number of results
print(type(tool))
print(tool.name)
<class 'langchain_community.tools.tavily_search.tool.TavilySearchResults'>
tavily_search_results_json
class AgentState(TypedDict):
    messages: Annotated[list[AnyMessage], operator.add]
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class Agent:
    def __init__(self, model, tools, system=""):
        self.system = system
        graph = StateGraph(AgentState)
        graph.add_node("llm", self.call_openai)
        graph.add_node("action", self.take_action)
        graph.add_conditional_edges(
            "llm",
            self.exists_action,
            {True: "action", False: END}
        )
        graph.add_edge("action", "llm")
        graph.set_entry_point("llm")
        self.graph = graph.compile()
        self.tools = {t.name: t for t in tools}
        self.model = model.bind_tools(tools)
        logger.info(f"model: {self.model}")

    def exists_action(self, state: AgentState):
        result = state['messages'][-1]
        logger.info(f"exists_action result: {result}")
        return len(result.tool_calls) > 0

    def call_openai(self, state: AgentState):
        logger.info(f"state: {state}")
        messages = state['messages']
        if self.system:
            messages = [SystemMessage(content=self.system)] + messages
        message = self.model.invoke(messages)
        logger.info(f"LLM message: {message}")
        return {'messages': [message]}

    def take_action(self, state: AgentState):
        import threading
        print(f"take_action called in thread: {threading.current_thread().name}")
        tool_calls = state['messages'][-1].tool_calls
        results = []
        print(f"take_action called with tool_calls: {tool_calls}")
        for t in tool_calls:
            logger.info(f"Calling: {t}")
            print(f"Calling: {t}") 
            if not t['name'] in self.tools:      # check for bad tool name from LLM
                print("\n ....bad tool name....")
                result = "bad tool name, retry"  # instruct LLM to retry if bad
            else:
                result = self.tools[t['name']].invoke(t['args'])
                logger.info(f"action {t['name']}, result: {result}")
                print(f"action {t['name']}, result: {result}")
            results.append(ToolMessage(tool_call_id=t['id'], name=t['name'], content=str(result)))
        print("Back to the model!")
        return {'messages': results}
prompt = """You are a smart research assistant. Use the search engine to look up information.  \
You are allowed to make multiple calls (either together or in sequence). \
Only look up information when you are sure of what you want. \
If you need to look up some information before asking a follow up question, you are allowed to do that!
"""
model = ChatOpenAI(model="gpt-4o")  #reduce inference cost
# model = ChatOpenAI(model="yi-large")
abot = Agent(model, [tool], system=prompt)
INFO:__main__:model: bound=ChatOpenAI(client=<openai.resources.chat.completions.Completions object at 0x0000029BECD41520>, async_client=<openai.resources.chat.completions.AsyncCompletions object at 0x0000029BECD43200>, model_name='gpt-4o', openai_api_key=SecretStr('**********'), openai_proxy='') kwargs={'tools': [{'type': 'function', 'function': {'name': 'tavily_search_results_json', 'description': 'A search engine optimized for comprehensive, accurate, and trusted results. Useful for when you need to answer questions about current events. Input should be a search query.', 'parameters': {'type': 'object', 'properties': {'query': {'description': 'search query to look up', 'type': 'string'}}, 'required': ['query']}}}]}
from IPython.display import Image

Image(abot.graph.get_graph().draw_png())

在这里插入图片描述

messages = [HumanMessage(content="What is the weather in sf?")]
result = abot.graph.invoke({"messages": messages})
INFO:__main__:state: {'messages': [HumanMessage(content='What is the weather in sf?')]}
INFO:httpx:HTTP Request: POST https://api.chatanywhere.tech/v1/chat/completions "HTTP/1.1 200 OK"
INFO:__main__:LLM message: content='' additional_kwargs={'tool_calls': [{'id': 'call_G1NzidVGnce0IG6VGUPp9xNk', 'function': {'arguments': '{"query":"current weather in San Francisco"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]} response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 152, 'total_tokens': 174}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d33f7b429e', 'finish_reason': 'tool_calls', 'logprobs': None} id='run-a06698d1-8bf1-4687-b27d-9dc66850dc7b-0' tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_G1NzidVGnce0IG6VGUPp9xNk'}] usage_metadata={'input_tokens': 152, 'output_tokens': 22, 'total_tokens': 174}
INFO:__main__:exists_action result: content='' additional_kwargs={'tool_calls': [{'id': 'call_G1NzidVGnce0IG6VGUPp9xNk', 'function': {'arguments': '{"query":"current weather in San Francisco"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]} response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 152, 'total_tokens': 174}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d33f7b429e', 'finish_reason': 'tool_calls', 'logprobs': None} id='run-a06698d1-8bf1-4687-b27d-9dc66850dc7b-0' tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_G1NzidVGnce0IG6VGUPp9xNk'}] usage_metadata={'input_tokens': 152, 'output_tokens': 22, 'total_tokens': 174}
INFO:__main__:Calling: {'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_G1NzidVGnce0IG6VGUPp9xNk'}


take_action called in thread: ThreadPoolExecutor-0_0
take_action called with tool_calls: [{'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_G1NzidVGnce0IG6VGUPp9xNk'}]
Calling: {'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_G1NzidVGnce0IG6VGUPp9xNk'}


INFO:__main__:action tavily_search_results_json, result: [{'url': 'https://www.timeanddate.com/weather/usa/san-francisco/hourly', 'content': 'Hour-by-Hour Forecast for San Francisco, California, USA. Currently: 54 °F. Passing clouds. (Weather station: San Francisco International Airport, USA). See more current weather.'}, {'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': 1720592691, 'localtime': '2024-07-09 23:24'}, 'current': {'last_updated_epoch': 1720592100, 'last_updated': '2024-07-09 23:15', 'temp_c': 16.1, 'temp_f': 61.0, 'is_day': 0, 'condition': {'text': 'Partly cloudy', 'icon': '//cdn.weatherapi.com/weather/64x64/night/116.png', 'code': 1003}, 'wind_mph': 9.4, 'wind_kph': 15.1, 'wind_degree': 290, 'wind_dir': 'WNW', 'pressure_mb': 1013.0, 'pressure_in': 29.9, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 90, 'cloud': 75, 'feelslike_c': 16.1, 'feelslike_f': 61.0, 'windchill_c': 13.5, 'windchill_f': 56.4, 'heatindex_c': 14.3, 'heatindex_f': 57.7, 'dewpoint_c': 12.7, 'dewpoint_f': 54.9, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 1.0, 'gust_mph': 11.8, 'gust_kph': 19.0}}"}]
INFO:__main__:state: {'messages': [HumanMessage(content='What is the weather in sf?'), AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_G1NzidVGnce0IG6VGUPp9xNk', 'function': {'arguments': '{"query":"current weather in San Francisco"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]}, response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 152, 'total_tokens': 174}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d33f7b429e', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-a06698d1-8bf1-4687-b27d-9dc66850dc7b-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_G1NzidVGnce0IG6VGUPp9xNk'}], usage_metadata={'input_tokens': 152, 'output_tokens': 22, 'total_tokens': 174}), ToolMessage(content='[{\'url\': \'https://www.timeanddate.com/weather/usa/san-francisco/hourly\', \'content\': \'Hour-by-Hour Forecast for San Francisco, California, USA. Currently: 54 °F. Passing clouds. (Weather station: San Francisco International Airport, USA). See more current weather.\'}, {\'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\': 1720592691, \'localtime\': \'2024-07-09 23:24\'}, \'current\': {\'last_updated_epoch\': 1720592100, \'last_updated\': \'2024-07-09 23:15\', \'temp_c\': 16.1, \'temp_f\': 61.0, \'is_day\': 0, \'condition\': {\'text\': \'Partly cloudy\', \'icon\': \'//cdn.weatherapi.com/weather/64x64/night/116.png\', \'code\': 1003}, \'wind_mph\': 9.4, \'wind_kph\': 15.1, \'wind_degree\': 290, \'wind_dir\': \'WNW\', \'pressure_mb\': 1013.0, \'pressure_in\': 29.9, \'precip_mm\': 0.0, \'precip_in\': 0.0, \'humidity\': 90, \'cloud\': 75, \'feelslike_c\': 16.1, \'feelslike_f\': 61.0, \'windchill_c\': 13.5, \'windchill_f\': 56.4, \'heatindex_c\': 14.3, \'heatindex_f\': 57.7, \'dewpoint_c\': 12.7, \'dewpoint_f\': 54.9, \'vis_km\': 16.0, \'vis_miles\': 9.0, \'uv\': 1.0, \'gust_mph\': 11.8, \'gust_kph\': 19.0}}"}]', name='tavily_search_results_json', tool_call_id='call_G1NzidVGnce0IG6VGUPp9xNk')]}


action tavily_search_results_json, result: [{'url': 'https://www.timeanddate.com/weather/usa/san-francisco/hourly', 'content': 'Hour-by-Hour Forecast for San Francisco, California, USA. Currently: 54 °F. Passing clouds. (Weather station: San Francisco International Airport, USA). See more current weather.'}, {'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': 1720592691, 'localtime': '2024-07-09 23:24'}, 'current': {'last_updated_epoch': 1720592100, 'last_updated': '2024-07-09 23:15', 'temp_c': 16.1, 'temp_f': 61.0, 'is_day': 0, 'condition': {'text': 'Partly cloudy', 'icon': '//cdn.weatherapi.com/weather/64x64/night/116.png', 'code': 1003}, 'wind_mph': 9.4, 'wind_kph': 15.1, 'wind_degree': 290, 'wind_dir': 'WNW', 'pressure_mb': 1013.0, 'pressure_in': 29.9, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 90, 'cloud': 75, 'feelslike_c': 16.1, 'feelslike_f': 61.0, 'windchill_c': 13.5, 'windchill_f': 56.4, 'heatindex_c': 14.3, 'heatindex_f': 57.7, 'dewpoint_c': 12.7, 'dewpoint_f': 54.9, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 1.0, 'gust_mph': 11.8, 'gust_kph': 19.0}}"}]
Back to the model!


INFO:httpx:HTTP Request: POST https://api.chatanywhere.tech/v1/chat/completions "HTTP/1.1 200 OK"
INFO:__main__:LLM message: content='The current weather in San Francisco is partly cloudy with a temperature of 61°F (16.1°C). The wind is blowing from the west-northwest at 9.4 mph (15.1 kph), and the humidity is at 90%.' response_metadata={'token_usage': {'completion_tokens': 54, 'prompt_tokens': 658, 'total_tokens': 712}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d33f7b429e', 'finish_reason': 'stop', 'logprobs': None} id='run-7543ad68-73c8-454e-b4de-14e16d7ad8c8-0' usage_metadata={'input_tokens': 658, 'output_tokens': 54, 'total_tokens': 712}
INFO:__main__:exists_action result: content='The current weather in San Francisco is partly cloudy with a temperature of 61°F (16.1°C). The wind is blowing from the west-northwest at 9.4 mph (15.1 kph), and the humidity is at 90%.' response_metadata={'token_usage': {'completion_tokens': 54, 'prompt_tokens': 658, 'total_tokens': 712}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d33f7b429e', 'finish_reason': 'stop', 'logprobs': None} id='run-7543ad68-73c8-454e-b4de-14e16d7ad8c8-0' usage_metadata={'input_tokens': 658, 'output_tokens': 54, 'total_tokens': 712}
result
{'messages': [HumanMessage(content='What is the weather in sf?'),
  AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_G1NzidVGnce0IG6VGUPp9xNk', 'function': {'arguments': '{"query":"current weather in San Francisco"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]}, response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 152, 'total_tokens': 174}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d33f7b429e', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-a06698d1-8bf1-4687-b27d-9dc66850dc7b-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_G1NzidVGnce0IG6VGUPp9xNk'}], usage_metadata={'input_tokens': 152, 'output_tokens': 22, 'total_tokens': 174}),
  ToolMessage(content='[{\'url\': \'https://www.timeanddate.com/weather/usa/san-francisco/hourly\', \'content\': \'Hour-by-Hour Forecast for San Francisco, California, USA. Currently: 54 °F. Passing clouds. (Weather station: San Francisco International Airport, USA). See more current weather.\'}, {\'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\': 1720592691, \'localtime\': \'2024-07-09 23:24\'}, \'current\': {\'last_updated_epoch\': 1720592100, \'last_updated\': \'2024-07-09 23:15\', \'temp_c\': 16.1, \'temp_f\': 61.0, \'is_day\': 0, \'condition\': {\'text\': \'Partly cloudy\', \'icon\': \'//cdn.weatherapi.com/weather/64x64/night/116.png\', \'code\': 1003}, \'wind_mph\': 9.4, \'wind_kph\': 15.1, \'wind_degree\': 290, \'wind_dir\': \'WNW\', \'pressure_mb\': 1013.0, \'pressure_in\': 29.9, \'precip_mm\': 0.0, \'precip_in\': 0.0, \'humidity\': 90, \'cloud\': 75, \'feelslike_c\': 16.1, \'feelslike_f\': 61.0, \'windchill_c\': 13.5, \'windchill_f\': 56.4, \'heatindex_c\': 14.3, \'heatindex_f\': 57.7, \'dewpoint_c\': 12.7, \'dewpoint_f\': 54.9, \'vis_km\': 16.0, \'vis_miles\': 9.0, \'uv\': 1.0, \'gust_mph\': 11.8, \'gust_kph\': 19.0}}"}]', name='tavily_search_results_json', tool_call_id='call_G1NzidVGnce0IG6VGUPp9xNk'),
  AIMessage(content='The current weather in San Francisco is partly cloudy with a temperature of 61°F (16.1°C). The wind is blowing from the west-northwest at 9.4 mph (15.1 kph), and the humidity is at 90%.', response_metadata={'token_usage': {'completion_tokens': 54, 'prompt_tokens': 658, 'total_tokens': 712}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d33f7b429e', 'finish_reason': 'stop', 'logprobs': None}, id='run-7543ad68-73c8-454e-b4de-14e16d7ad8c8-0', usage_metadata={'input_tokens': 658, 'output_tokens': 54, 'total_tokens': 712})]}
result['messages'][-1].content
'The current weather in San Francisco is partly cloudy with a temperature of 61°F (16.1°C). The wind is blowing from the west-northwest at 9.4 mph (15.1 kph), and the humidity is at 90%.'
messages = [HumanMessage(content="What is the weather in SF and LA?")]
result = abot.graph.invoke({"messages": messages})
INFO:__main__:state: {'messages': [HumanMessage(content='What is the weather in SF and LA?')]}
INFO:httpx:HTTP Request: POST https://api.chatanywhere.tech/v1/chat/completions "HTTP/1.1 200 OK"
INFO:__main__:LLM message: content='' additional_kwargs={'tool_calls': [{'id': 'call_kdq99sJ89Icj8XO3JiDBqgzg', 'function': {'arguments': '{"query": "current weather in San Francisco"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}, {'id': 'call_LFYn4VtDMAhv014a7EfZoKS4', 'function': {'arguments': '{"query": "current weather in Los Angeles"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]} response_metadata={'token_usage': {'completion_tokens': 60, 'prompt_tokens': 154, 'total_tokens': 214}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d576307f90', 'finish_reason': 'tool_calls', 'logprobs': None} id='run-4f5b63b9-857e-4a59-ae40-b9804bb1f5be-0' tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_kdq99sJ89Icj8XO3JiDBqgzg'}, {'name': 'tavily_search_results_json', 'args': {'query': 'current weather in Los Angeles'}, 'id': 'call_LFYn4VtDMAhv014a7EfZoKS4'}] usage_metadata={'input_tokens': 154, 'output_tokens': 60, 'total_tokens': 214}
INFO:__main__:exists_action result: content='' additional_kwargs={'tool_calls': [{'id': 'call_kdq99sJ89Icj8XO3JiDBqgzg', 'function': {'arguments': '{"query": "current weather in San Francisco"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}, {'id': 'call_LFYn4VtDMAhv014a7EfZoKS4', 'function': {'arguments': '{"query": "current weather in Los Angeles"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]} response_metadata={'token_usage': {'completion_tokens': 60, 'prompt_tokens': 154, 'total_tokens': 214}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d576307f90', 'finish_reason': 'tool_calls', 'logprobs': None} id='run-4f5b63b9-857e-4a59-ae40-b9804bb1f5be-0' tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_kdq99sJ89Icj8XO3JiDBqgzg'}, {'name': 'tavily_search_results_json', 'args': {'query': 'current weather in Los Angeles'}, 'id': 'call_LFYn4VtDMAhv014a7EfZoKS4'}] usage_metadata={'input_tokens': 154, 'output_tokens': 60, 'total_tokens': 214}
INFO:__main__:Calling: {'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_kdq99sJ89Icj8XO3JiDBqgzg'}


take_action called in thread: ThreadPoolExecutor-1_0
take_action called with tool_calls: [{'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_kdq99sJ89Icj8XO3JiDBqgzg'}, {'name': 'tavily_search_results_json', 'args': {'query': 'current weather in Los Angeles'}, 'id': 'call_LFYn4VtDMAhv014a7EfZoKS4'}]
Calling: {'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_kdq99sJ89Icj8XO3JiDBqgzg'}


INFO:__main__:action tavily_search_results_json, result: [{'url': 'https://www.wunderground.com/hourly/us/ca/san-francisco/94188/date/2024-7-10', 'content': 'San Francisco Weather Forecasts. Weather Underground provides local & long-range weather forecasts, weatherreports, maps & tropical weather conditions for the San Francisco area. ... Wednesday 07/ ...'}, {'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': 1720592691, 'localtime': '2024-07-09 23:24'}, 'current': {'last_updated_epoch': 1720592100, 'last_updated': '2024-07-09 23:15', 'temp_c': 16.1, 'temp_f': 61.0, 'is_day': 0, 'condition': {'text': 'Partly cloudy', 'icon': '//cdn.weatherapi.com/weather/64x64/night/116.png', 'code': 1003}, 'wind_mph': 9.4, 'wind_kph': 15.1, 'wind_degree': 290, 'wind_dir': 'WNW', 'pressure_mb': 1013.0, 'pressure_in': 29.9, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 90, 'cloud': 75, 'feelslike_c': 16.1, 'feelslike_f': 61.0, 'windchill_c': 13.5, 'windchill_f': 56.4, 'heatindex_c': 14.3, 'heatindex_f': 57.7, 'dewpoint_c': 12.7, 'dewpoint_f': 54.9, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 1.0, 'gust_mph': 11.8, 'gust_kph': 19.0}}"}]
INFO:__main__:Calling: {'name': 'tavily_search_results_json', 'args': {'query': 'current weather in Los Angeles'}, 'id': 'call_LFYn4VtDMAhv014a7EfZoKS4'}


action tavily_search_results_json, result: [{'url': 'https://www.wunderground.com/hourly/us/ca/san-francisco/94188/date/2024-7-10', 'content': 'San Francisco Weather Forecasts. Weather Underground provides local & long-range weather forecasts, weatherreports, maps & tropical weather conditions for the San Francisco area. ... Wednesday 07/ ...'}, {'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': 1720592691, 'localtime': '2024-07-09 23:24'}, 'current': {'last_updated_epoch': 1720592100, 'last_updated': '2024-07-09 23:15', 'temp_c': 16.1, 'temp_f': 61.0, 'is_day': 0, 'condition': {'text': 'Partly cloudy', 'icon': '//cdn.weatherapi.com/weather/64x64/night/116.png', 'code': 1003}, 'wind_mph': 9.4, 'wind_kph': 15.1, 'wind_degree': 290, 'wind_dir': 'WNW', 'pressure_mb': 1013.0, 'pressure_in': 29.9, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 90, 'cloud': 75, 'feelslike_c': 16.1, 'feelslike_f': 61.0, 'windchill_c': 13.5, 'windchill_f': 56.4, 'heatindex_c': 14.3, 'heatindex_f': 57.7, 'dewpoint_c': 12.7, 'dewpoint_f': 54.9, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 1.0, 'gust_mph': 11.8, 'gust_kph': 19.0}}"}]
Calling: {'name': 'tavily_search_results_json', 'args': {'query': 'current weather in Los Angeles'}, 'id': 'call_LFYn4VtDMAhv014a7EfZoKS4'}


INFO:__main__:action tavily_search_results_json, result: [{'url': 'https://www.wunderground.com/hourly/us/ca/los-angeles/90026/date/2024-07-10', 'content': 'Weather Underground provides local & long-range weather forecasts, weatherreports, maps & tropical weather conditions for the Los Angeles area. ... Wednesday 07/10 Hourly for Tomorrow, Wed 07/10'}, {'url': 'https://www.weatherapi.com/', 'content': "{'location': {'name': 'Los Angeles', 'region': 'California', 'country': 'United States of America', 'lat': 34.05, 'lon': -118.24, 'tz_id': 'America/Los_Angeles', 'localtime_epoch': 1720592759, 'localtime': '2024-07-09 23:25'}, 'current': {'last_updated_epoch': 1720592100, 'last_updated': '2024-07-09 23:15', 'temp_c': 18.3, 'temp_f': 64.9, 'is_day': 0, 'condition': {'text': 'Partly cloudy', 'icon': '//cdn.weatherapi.com/weather/64x64/night/116.png', 'code': 1003}, 'wind_mph': 3.8, 'wind_kph': 6.1, 'wind_degree': 290, 'wind_dir': 'WNW', 'pressure_mb': 1010.0, 'pressure_in': 29.83, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 84, 'cloud': 50, 'feelslike_c': 18.3, 'feelslike_f': 64.9, 'windchill_c': 24.8, 'windchill_f': 76.6, 'heatindex_c': 25.7, 'heatindex_f': 78.3, 'dewpoint_c': 13.9, 'dewpoint_f': 57.0, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 1.0, 'gust_mph': 3.9, 'gust_kph': 6.2}}"}]
INFO:__main__:state: {'messages': [HumanMessage(content='What is the weather in SF and LA?'), AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_kdq99sJ89Icj8XO3JiDBqgzg', 'function': {'arguments': '{"query": "current weather in San Francisco"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}, {'id': 'call_LFYn4VtDMAhv014a7EfZoKS4', 'function': {'arguments': '{"query": "current weather in Los Angeles"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]}, response_metadata={'token_usage': {'completion_tokens': 60, 'prompt_tokens': 154, 'total_tokens': 214}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d576307f90', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-4f5b63b9-857e-4a59-ae40-b9804bb1f5be-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_kdq99sJ89Icj8XO3JiDBqgzg'}, {'name': 'tavily_search_results_json', 'args': {'query': 'current weather in Los Angeles'}, 'id': 'call_LFYn4VtDMAhv014a7EfZoKS4'}], usage_metadata={'input_tokens': 154, 'output_tokens': 60, 'total_tokens': 214}), ToolMessage(content='[{\'url\': \'https://www.wunderground.com/hourly/us/ca/san-francisco/94188/date/2024-7-10\', \'content\': \'San Francisco Weather Forecasts. Weather Underground provides local & long-range weather forecasts, weatherreports, maps & tropical weather conditions for the San Francisco area. ... Wednesday 07/ ...\'}, {\'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\': 1720592691, \'localtime\': \'2024-07-09 23:24\'}, \'current\': {\'last_updated_epoch\': 1720592100, \'last_updated\': \'2024-07-09 23:15\', \'temp_c\': 16.1, \'temp_f\': 61.0, \'is_day\': 0, \'condition\': {\'text\': \'Partly cloudy\', \'icon\': \'//cdn.weatherapi.com/weather/64x64/night/116.png\', \'code\': 1003}, \'wind_mph\': 9.4, \'wind_kph\': 15.1, \'wind_degree\': 290, \'wind_dir\': \'WNW\', \'pressure_mb\': 1013.0, \'pressure_in\': 29.9, \'precip_mm\': 0.0, \'precip_in\': 0.0, \'humidity\': 90, \'cloud\': 75, \'feelslike_c\': 16.1, \'feelslike_f\': 61.0, \'windchill_c\': 13.5, \'windchill_f\': 56.4, \'heatindex_c\': 14.3, \'heatindex_f\': 57.7, \'dewpoint_c\': 12.7, \'dewpoint_f\': 54.9, \'vis_km\': 16.0, \'vis_miles\': 9.0, \'uv\': 1.0, \'gust_mph\': 11.8, \'gust_kph\': 19.0}}"}]', name='tavily_search_results_json', tool_call_id='call_kdq99sJ89Icj8XO3JiDBqgzg'), ToolMessage(content='[{\'url\': \'https://www.wunderground.com/hourly/us/ca/los-angeles/90026/date/2024-07-10\', \'content\': \'Weather Underground provides local & long-range weather forecasts, weatherreports, maps & tropical weather conditions for the Los Angeles area. ... Wednesday 07/10 Hourly for Tomorrow, Wed 07/10\'}, {\'url\': \'https://www.weatherapi.com/\', \'content\': "{\'location\': {\'name\': \'Los Angeles\', \'region\': \'California\', \'country\': \'United States of America\', \'lat\': 34.05, \'lon\': -118.24, \'tz_id\': \'America/Los_Angeles\', \'localtime_epoch\': 1720592759, \'localtime\': \'2024-07-09 23:25\'}, \'current\': {\'last_updated_epoch\': 1720592100, \'last_updated\': \'2024-07-09 23:15\', \'temp_c\': 18.3, \'temp_f\': 64.9, \'is_day\': 0, \'condition\': {\'text\': \'Partly cloudy\', \'icon\': \'//cdn.weatherapi.com/weather/64x64/night/116.png\', \'code\': 1003}, \'wind_mph\': 3.8, \'wind_kph\': 6.1, \'wind_degree\': 290, \'wind_dir\': \'WNW\', \'pressure_mb\': 1010.0, \'pressure_in\': 29.83, \'precip_mm\': 0.0, \'precip_in\': 0.0, \'humidity\': 84, \'cloud\': 50, \'feelslike_c\': 18.3, \'feelslike_f\': 64.9, \'windchill_c\': 24.8, \'windchill_f\': 76.6, \'heatindex_c\': 25.7, \'heatindex_f\': 78.3, \'dewpoint_c\': 13.9, \'dewpoint_f\': 57.0, \'vis_km\': 16.0, \'vis_miles\': 9.0, \'uv\': 1.0, \'gust_mph\': 3.9, \'gust_kph\': 6.2}}"}]', name='tavily_search_results_json', tool_call_id='call_LFYn4VtDMAhv014a7EfZoKS4')]}


action tavily_search_results_json, result: [{'url': 'https://www.wunderground.com/hourly/us/ca/los-angeles/90026/date/2024-07-10', 'content': 'Weather Underground provides local & long-range weather forecasts, weatherreports, maps & tropical weather conditions for the Los Angeles area. ... Wednesday 07/10 Hourly for Tomorrow, Wed 07/10'}, {'url': 'https://www.weatherapi.com/', 'content': "{'location': {'name': 'Los Angeles', 'region': 'California', 'country': 'United States of America', 'lat': 34.05, 'lon': -118.24, 'tz_id': 'America/Los_Angeles', 'localtime_epoch': 1720592759, 'localtime': '2024-07-09 23:25'}, 'current': {'last_updated_epoch': 1720592100, 'last_updated': '2024-07-09 23:15', 'temp_c': 18.3, 'temp_f': 64.9, 'is_day': 0, 'condition': {'text': 'Partly cloudy', 'icon': '//cdn.weatherapi.com/weather/64x64/night/116.png', 'code': 1003}, 'wind_mph': 3.8, 'wind_kph': 6.1, 'wind_degree': 290, 'wind_dir': 'WNW', 'pressure_mb': 1010.0, 'pressure_in': 29.83, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 84, 'cloud': 50, 'feelslike_c': 18.3, 'feelslike_f': 64.9, 'windchill_c': 24.8, 'windchill_f': 76.6, 'heatindex_c': 25.7, 'heatindex_f': 78.3, 'dewpoint_c': 13.9, 'dewpoint_f': 57.0, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 1.0, 'gust_mph': 3.9, 'gust_kph': 6.2}}"}]
Back to the model!


INFO:httpx:HTTP Request: POST https://api.chatanywhere.tech/v1/chat/completions "HTTP/1.1 200 OK"
INFO:__main__:LLM message: content='### San Francisco Weather:\n- **Temperature**: 16.1°C (61.0°F)\n- **Condition**: Partly cloudy\n- **Wind**: 9.4 mph (15.1 kph) from WNW\n- **Humidity**: 90%\n- **Visibility**: 16 km (9 miles)\n- **Pressure**: 1013 mb\n- **UV Index**: 1.0\n\n### Los Angeles Weather:\n- **Temperature**: 18.3°C (64.9°F)\n- **Condition**: Partly cloudy\n- **Wind**: 3.8 mph (6.1 kph) from WNW\n- **Humidity**: 84%\n- **Visibility**: 16 km (9 miles)\n- **Pressure**: 1010 mb\n- **UV Index**: 1.0' response_metadata={'token_usage': {'completion_tokens': 184, 'prompt_tokens': 1190, 'total_tokens': 1374}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_4008e3b719', 'finish_reason': 'stop', 'logprobs': None} id='run-c8c63c14-0b42-4b2a-8a52-5542b14311f5-0' usage_metadata={'input_tokens': 1190, 'output_tokens': 184, 'total_tokens': 1374}
INFO:__main__:exists_action result: content='### San Francisco Weather:\n- **Temperature**: 16.1°C (61.0°F)\n- **Condition**: Partly cloudy\n- **Wind**: 9.4 mph (15.1 kph) from WNW\n- **Humidity**: 90%\n- **Visibility**: 16 km (9 miles)\n- **Pressure**: 1013 mb\n- **UV Index**: 1.0\n\n### Los Angeles Weather:\n- **Temperature**: 18.3°C (64.9°F)\n- **Condition**: Partly cloudy\n- **Wind**: 3.8 mph (6.1 kph) from WNW\n- **Humidity**: 84%\n- **Visibility**: 16 km (9 miles)\n- **Pressure**: 1010 mb\n- **UV Index**: 1.0' response_metadata={'token_usage': {'completion_tokens': 184, 'prompt_tokens': 1190, 'total_tokens': 1374}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_4008e3b719', 'finish_reason': 'stop', 'logprobs': None} id='run-c8c63c14-0b42-4b2a-8a52-5542b14311f5-0' usage_metadata={'input_tokens': 1190, 'output_tokens': 184, 'total_tokens': 1374}
result['messages'][-1].content
'### San Francisco Weather:\n- **Temperature**: 16.1°C (61.0°F)\n- **Condition**: Partly cloudy\n- **Wind**: 9.4 mph (15.1 kph) from WNW\n- **Humidity**: 90%\n- **Visibility**: 16 km (9 miles)\n- **Pressure**: 1013 mb\n- **UV Index**: 1.0\n\n### Los Angeles Weather:\n- **Temperature**: 18.3°C (64.9°F)\n- **Condition**: Partly cloudy\n- **Wind**: 3.8 mph (6.1 kph) from WNW\n- **Humidity**: 84%\n- **Visibility**: 16 km (9 miles)\n- **Pressure**: 1010 mb\n- **UV Index**: 1.0'
query = "Who won the super bowl in 2024? In what state is the winning team headquarters located? \
What is the GDP of that state? Answer each question." 
messages = [HumanMessage(content=query)]
result = abot.graph.invoke({"messages": messages})
INFO:__main__:state: {'messages': [HumanMessage(content='Who won the super bowl in 2024? In what state is the winning team headquarters located? What is the GDP of that state? Answer each question.')]}
INFO:httpx:HTTP Request: POST https://api.chatanywhere.tech/v1/chat/completions "HTTP/1.1 200 OK"
INFO:__main__:LLM message: content='' additional_kwargs={'tool_calls': [{'id': 'call_r4Su82QJqD03HLQ2Anh5f6eG', 'function': {'arguments': '{"query": "Super Bowl 2024 winner"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}, {'id': 'call_uNfBjk7uNU7yuDj0HEkgIzsc', 'function': {'arguments': '{"query": "GDP of state where the Super Bowl 2024 winning team is located"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]} response_metadata={'token_usage': {'completion_tokens': 70, 'prompt_tokens': 177, 'total_tokens': 247}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_298125635f', 'finish_reason': 'tool_calls', 'logprobs': None} id='run-c9583580-7404-491a-9e08-69fab8c54719-0' tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'Super Bowl 2024 winner'}, 'id': 'call_r4Su82QJqD03HLQ2Anh5f6eG'}, {'name': 'tavily_search_results_json', 'args': {'query': 'GDP of state where the Super Bowl 2024 winning team is located'}, 'id': 'call_uNfBjk7uNU7yuDj0HEkgIzsc'}] usage_metadata={'input_tokens': 177, 'output_tokens': 70, 'total_tokens': 247}
INFO:__main__:exists_action result: content='' additional_kwargs={'tool_calls': [{'id': 'call_r4Su82QJqD03HLQ2Anh5f6eG', 'function': {'arguments': '{"query": "Super Bowl 2024 winner"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}, {'id': 'call_uNfBjk7uNU7yuDj0HEkgIzsc', 'function': {'arguments': '{"query": "GDP of state where the Super Bowl 2024 winning team is located"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]} response_metadata={'token_usage': {'completion_tokens': 70, 'prompt_tokens': 177, 'total_tokens': 247}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_298125635f', 'finish_reason': 'tool_calls', 'logprobs': None} id='run-c9583580-7404-491a-9e08-69fab8c54719-0' tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'Super Bowl 2024 winner'}, 'id': 'call_r4Su82QJqD03HLQ2Anh5f6eG'}, {'name': 'tavily_search_results_json', 'args': {'query': 'GDP of state where the Super Bowl 2024 winning team is located'}, 'id': 'call_uNfBjk7uNU7yuDj0HEkgIzsc'}] usage_metadata={'input_tokens': 177, 'output_tokens': 70, 'total_tokens': 247}
INFO:__main__:Calling: {'name': 'tavily_search_results_json', 'args': {'query': 'Super Bowl 2024 winner'}, 'id': 'call_r4Su82QJqD03HLQ2Anh5f6eG'}


take_action called in thread: ThreadPoolExecutor-2_0
take_action called with tool_calls: [{'name': 'tavily_search_results_json', 'args': {'query': 'Super Bowl 2024 winner'}, 'id': 'call_r4Su82QJqD03HLQ2Anh5f6eG'}, {'name': 'tavily_search_results_json', 'args': {'query': 'GDP of state where the Super Bowl 2024 winning team is located'}, 'id': 'call_uNfBjk7uNU7yuDj0HEkgIzsc'}]
Calling: {'name': 'tavily_search_results_json', 'args': {'query': 'Super Bowl 2024 winner'}, 'id': 'call_r4Su82QJqD03HLQ2Anh5f6eG'}


INFO:__main__:action tavily_search_results_json, result: [{'url': 'https://apnews.com/live/super-bowl-2024-updates', 'content': 'Throw in the fact that Chiefs coach Andy Reid will be in his fifth Super Bowl, the third most in NFL history, and has a chance to win a third ring, and the knowledge on the Kansas City sideline will be an advantage too big for the 49ers to overcome.\n She performed in Japan on Saturday night before a flight across nine time zones and the international date line to reach the U.S.\nRihanna performs during halftime of the NFL Super Bowl 57 football game between the Philadelphia Eagles and the Kansas City Chiefs, Sunday, Feb. 12, 2023, in Glendale, Ariz. (AP Photo/David J. Phillip)\n After the teams take the field, Post Malone will perform “America the Beautiful” and Reba McEntire will sing “The Star-Spangled Banner.”\nSan Francisco 49ers quarterback Brock Purdy (13) warms up before the NFL Super Bowl 58 football game against the Kansas City Chiefs, Sunday, Feb. 11, 2024, in Las Vegas. He was also the referee when the Chiefs beat the 49ers in the Super Bowl four years ago — and when the Rams beat the Saints in the 2019 NFC championship game after an infamous missed call.\n Purdy’s comeback from the injury to his throwing arm suffered in last season’s NFC championship loss to the Philadelphia Eagles has been part of the storybook start to his career that started as Mr. Irrelevant as the 262nd pick in the 2022 draft.\n'}, {'url': 'https://www.cbssports.com/nfl/news/2024-super-bowl-chiefs-vs-49ers-score-patrick-mahomes-leads-ot-comeback-as-k-c-wins-back-to-back-titles/live/', 'content': "The championship-winning drive, which included a fourth-and-1 scramble from Mahomes and a clutch 7-yard catch from tight end Travis Kelce, was a must-score for K.C. The NFL's new playoff overtime rules -- both teams are guaranteed at least one possession in the extra period -- were in effect for the first time, and the Chiefs needed to answer the Niners' field goal.\n Held out of the end zone until that point, Kansas City grabbed its first lead of the game at 13-10.\nJennings' touchdown receiving (followed by a missed extra point) concluded a 75-yard drive that put the Niners back on top, 16-13, as the wideout joined former Philadelphia Eagles quarterback Nick Foles as the only players to throw and catch a touchdown in a Super Bowl.\n He spread the ball around -- eight pass-catchers had at least two receptions -- slowly but surely overcoming a threatening 49ers defense that knocked him off his spot consistently in the first half.\nMahomes, with his third Super Bowl MVP, now sits alongside Tom Brady (five) and Joe Montana (three) atop the mountain while becoming just the third player to win the award back-to-back, joining Bart Starr (I-II) and Terry Bradshaw (XIII-XIV).\n The muffed punt that bounced off of cornerback Darrell Luter Jr.'s ankle was also the big break that the Chiefs needed as they scored on the very next play to take the lead for the first time in the game. College Pick'em\nA Daily SportsLine Betting Podcast\nNFL Playoff Time!\n2024 Super Bowl, Chiefs vs. 49ers score: Patrick Mahomes leads OT comeback as K.C. wins back-to-back titles\nCall it a dynasty; the Chiefs are the first team to win consecutive Super Bowls since 2003-04\nThe Kansas City Chiefs are Super Bowl champions, again."}]
INFO:__main__:Calling: {'name': 'tavily_search_results_json', 'args': {'query': 'GDP of state where the Super Bowl 2024 winning team is located'}, 'id': 'call_uNfBjk7uNU7yuDj0HEkgIzsc'}


action tavily_search_results_json, result: [{'url': 'https://apnews.com/live/super-bowl-2024-updates', 'content': 'Throw in the fact that Chiefs coach Andy Reid will be in his fifth Super Bowl, the third most in NFL history, and has a chance to win a third ring, and the knowledge on the Kansas City sideline will be an advantage too big for the 49ers to overcome.\n She performed in Japan on Saturday night before a flight across nine time zones and the international date line to reach the U.S.\nRihanna performs during halftime of the NFL Super Bowl 57 football game between the Philadelphia Eagles and the Kansas City Chiefs, Sunday, Feb. 12, 2023, in Glendale, Ariz. (AP Photo/David J. Phillip)\n After the teams take the field, Post Malone will perform “America the Beautiful” and Reba McEntire will sing “The Star-Spangled Banner.”\nSan Francisco 49ers quarterback Brock Purdy (13) warms up before the NFL Super Bowl 58 football game against the Kansas City Chiefs, Sunday, Feb. 11, 2024, in Las Vegas. He was also the referee when the Chiefs beat the 49ers in the Super Bowl four years ago — and when the Rams beat the Saints in the 2019 NFC championship game after an infamous missed call.\n Purdy’s comeback from the injury to his throwing arm suffered in last season’s NFC championship loss to the Philadelphia Eagles has been part of the storybook start to his career that started as Mr. Irrelevant as the 262nd pick in the 2022 draft.\n'}, {'url': 'https://www.cbssports.com/nfl/news/2024-super-bowl-chiefs-vs-49ers-score-patrick-mahomes-leads-ot-comeback-as-k-c-wins-back-to-back-titles/live/', 'content': "The championship-winning drive, which included a fourth-and-1 scramble from Mahomes and a clutch 7-yard catch from tight end Travis Kelce, was a must-score for K.C. The NFL's new playoff overtime rules -- both teams are guaranteed at least one possession in the extra period -- were in effect for the first time, and the Chiefs needed to answer the Niners' field goal.\n Held out of the end zone until that point, Kansas City grabbed its first lead of the game at 13-10.\nJennings' touchdown receiving (followed by a missed extra point) concluded a 75-yard drive that put the Niners back on top, 16-13, as the wideout joined former Philadelphia Eagles quarterback Nick Foles as the only players to throw and catch a touchdown in a Super Bowl.\n He spread the ball around -- eight pass-catchers had at least two receptions -- slowly but surely overcoming a threatening 49ers defense that knocked him off his spot consistently in the first half.\nMahomes, with his third Super Bowl MVP, now sits alongside Tom Brady (five) and Joe Montana (three) atop the mountain while becoming just the third player to win the award back-to-back, joining Bart Starr (I-II) and Terry Bradshaw (XIII-XIV).\n The muffed punt that bounced off of cornerback Darrell Luter Jr.'s ankle was also the big break that the Chiefs needed as they scored on the very next play to take the lead for the first time in the game. College Pick'em\nA Daily SportsLine Betting Podcast\nNFL Playoff Time!\n2024 Super Bowl, Chiefs vs. 49ers score: Patrick Mahomes leads OT comeback as K.C. wins back-to-back titles\nCall it a dynasty; the Chiefs are the first team to win consecutive Super Bowls since 2003-04\nThe Kansas City Chiefs are Super Bowl champions, again."}]
Calling: {'name': 'tavily_search_results_json', 'args': {'query': 'GDP of state where the Super Bowl 2024 winning team is located'}, 'id': 'call_uNfBjk7uNU7yuDj0HEkgIzsc'}


INFO:__main__:action tavily_search_results_json, result: [{'url': 'https://www.forbes.com/sites/jefffedotin/2024/06/03/super-bowl-lviii-generated-1-billion-economic-impact-for-las-vegas/', 'content': 'An average of 123.7 million watched the Kansas City Chiefs defeat the San Francisco 49ers in a 25-22, overtime classic on Super Bowl Sunday, but for Las Vegas, the economic impact started much ...'}, {'url': 'https://www.rollingstone.com/culture/culture-features/2024-super-bowl-helping-las-vegas-economy-1234964688/', 'content': "The 2024 Super Bowl Is Helping Las Vegas' Economy More Than Usual. big profits. Las Vegas Spent Decades Deprived of the Super Bowl. Now It Could Bring in $700 Million. After years of the NFL ..."}]
INFO:__main__:state: {'messages': [HumanMessage(content='Who won the super bowl in 2024? In what state is the winning team headquarters located? What is the GDP of that state? Answer each question.'), AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_r4Su82QJqD03HLQ2Anh5f6eG', 'function': {'arguments': '{"query": "Super Bowl 2024 winner"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}, {'id': 'call_uNfBjk7uNU7yuDj0HEkgIzsc', 'function': {'arguments': '{"query": "GDP of state where the Super Bowl 2024 winning team is located"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]}, response_metadata={'token_usage': {'completion_tokens': 70, 'prompt_tokens': 177, 'total_tokens': 247}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_298125635f', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-c9583580-7404-491a-9e08-69fab8c54719-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'Super Bowl 2024 winner'}, 'id': 'call_r4Su82QJqD03HLQ2Anh5f6eG'}, {'name': 'tavily_search_results_json', 'args': {'query': 'GDP of state where the Super Bowl 2024 winning team is located'}, 'id': 'call_uNfBjk7uNU7yuDj0HEkgIzsc'}], usage_metadata={'input_tokens': 177, 'output_tokens': 70, 'total_tokens': 247}), ToolMessage(content='[{\'url\': \'https://apnews.com/live/super-bowl-2024-updates\', \'content\': \'Throw in the fact that Chiefs coach Andy Reid will be in his fifth Super Bowl, the third most in NFL history, and has a chance to win a third ring, and the knowledge on the Kansas City sideline will be an advantage too big for the 49ers to overcome.\\n She performed in Japan on Saturday night before a flight across nine time zones and the international date line to reach the U.S.\\nRihanna performs during halftime of the NFL Super Bowl 57 football game between the Philadelphia Eagles and the Kansas City Chiefs, Sunday, Feb. 12, 2023, in Glendale, Ariz. (AP Photo/David J. Phillip)\\n After the teams take the field, Post Malone will perform “America the Beautiful” and Reba McEntire will sing “The Star-Spangled Banner.”\\nSan Francisco 49ers quarterback Brock Purdy (13) warms up before the NFL Super Bowl 58 football game against the Kansas City Chiefs, Sunday, Feb. 11, 2024, in Las Vegas. He was also the referee when the Chiefs beat the 49ers in the Super Bowl four years ago — and when the Rams beat the Saints in the 2019 NFC championship game after an infamous missed call.\\n Purdy’s comeback from the injury to his throwing arm suffered in last season’s NFC championship loss to the Philadelphia Eagles has been part of the storybook start to his career that started as Mr. Irrelevant as the 262nd pick in the 2022 draft.\\n\'}, {\'url\': \'https://www.cbssports.com/nfl/news/2024-super-bowl-chiefs-vs-49ers-score-patrick-mahomes-leads-ot-comeback-as-k-c-wins-back-to-back-titles/live/\', \'content\': "The championship-winning drive, which included a fourth-and-1 scramble from Mahomes and a clutch 7-yard catch from tight end Travis Kelce, was a must-score for K.C. The NFL\'s new playoff overtime rules -- both teams are guaranteed at least one possession in the extra period -- were in effect for the first time, and the Chiefs needed to answer the Niners\' field goal.\\n Held out of the end zone until that point, Kansas City grabbed its first lead of the game at 13-10.\\nJennings\' touchdown receiving (followed by a missed extra point) concluded a 75-yard drive that put the Niners back on top, 16-13, as the wideout joined former Philadelphia Eagles quarterback Nick Foles as the only players to throw and catch a touchdown in a Super Bowl.\\n He spread the ball around -- eight pass-catchers had at least two receptions -- slowly but surely overcoming a threatening 49ers defense that knocked him off his spot consistently in the first half.\\nMahomes, with his third Super Bowl MVP, now sits alongside Tom Brady (five) and Joe Montana (three) atop the mountain while becoming just the third player to win the award back-to-back, joining Bart Starr (I-II) and Terry Bradshaw (XIII-XIV).\\n The muffed punt that bounced off of cornerback Darrell Luter Jr.\'s ankle was also the big break that the Chiefs needed as they scored on the very next play to take the lead for the first time in the game. College Pick\'em\\nA Daily SportsLine Betting Podcast\\nNFL Playoff Time!\\n2024 Super Bowl, Chiefs vs. 49ers score: Patrick Mahomes leads OT comeback as K.C. wins back-to-back titles\\nCall it a dynasty; the Chiefs are the first team to win consecutive Super Bowls since 2003-04\\nThe Kansas City Chiefs are Super Bowl champions, again."}]', name='tavily_search_results_json', tool_call_id='call_r4Su82QJqD03HLQ2Anh5f6eG'), ToolMessage(content='[{\'url\': \'https://www.forbes.com/sites/jefffedotin/2024/06/03/super-bowl-lviii-generated-1-billion-economic-impact-for-las-vegas/\', \'content\': \'An average of 123.7 million watched the Kansas City Chiefs defeat the San Francisco 49ers in a 25-22, overtime classic on Super Bowl Sunday, but for Las Vegas, the economic impact started much ...\'}, {\'url\': \'https://www.rollingstone.com/culture/culture-features/2024-super-bowl-helping-las-vegas-economy-1234964688/\', \'content\': "The 2024 Super Bowl Is Helping Las Vegas\' Economy More Than Usual. big profits. Las Vegas Spent Decades Deprived of the Super Bowl. Now It Could Bring in $700 Million. After years of the NFL ..."}]', name='tavily_search_results_json', tool_call_id='call_uNfBjk7uNU7yuDj0HEkgIzsc')]}


action tavily_search_results_json, result: [{'url': 'https://www.forbes.com/sites/jefffedotin/2024/06/03/super-bowl-lviii-generated-1-billion-economic-impact-for-las-vegas/', 'content': 'An average of 123.7 million watched the Kansas City Chiefs defeat the San Francisco 49ers in a 25-22, overtime classic on Super Bowl Sunday, but for Las Vegas, the economic impact started much ...'}, {'url': 'https://www.rollingstone.com/culture/culture-features/2024-super-bowl-helping-las-vegas-economy-1234964688/', 'content': "The 2024 Super Bowl Is Helping Las Vegas' Economy More Than Usual. big profits. Las Vegas Spent Decades Deprived of the Super Bowl. Now It Could Bring in $700 Million. After years of the NFL ..."}]
Back to the model!


INFO:httpx:HTTP Request: POST https://api.chatanywhere.tech/v1/chat/completions "HTTP/1.1 200 OK"
INFO:__main__:LLM message: content='1. The Kansas City Chiefs won the Super Bowl in 2024.\n2. The headquarters of the Kansas City Chiefs is located in Kansas City, Missouri.\n3. I will now look up the GDP of Missouri.' additional_kwargs={'tool_calls': [{'id': 'call_yHyeCHMR88aog66cjLdOYTYf', 'function': {'arguments': '{"query":"GDP of Missouri 2024"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]} response_metadata={'token_usage': {'completion_tokens': 68, 'prompt_tokens': 1267, 'total_tokens': 1335}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d33f7b429e', 'finish_reason': 'tool_calls', 'logprobs': None} id='run-dfad5985-c34f-4c56-ab0f-7eec127e4419-0' tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'GDP of Missouri 2024'}, 'id': 'call_yHyeCHMR88aog66cjLdOYTYf'}] usage_metadata={'input_tokens': 1267, 'output_tokens': 68, 'total_tokens': 1335}
INFO:__main__:exists_action result: content='1. The Kansas City Chiefs won the Super Bowl in 2024.\n2. The headquarters of the Kansas City Chiefs is located in Kansas City, Missouri.\n3. I will now look up the GDP of Missouri.' additional_kwargs={'tool_calls': [{'id': 'call_yHyeCHMR88aog66cjLdOYTYf', 'function': {'arguments': '{"query":"GDP of Missouri 2024"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]} response_metadata={'token_usage': {'completion_tokens': 68, 'prompt_tokens': 1267, 'total_tokens': 1335}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d33f7b429e', 'finish_reason': 'tool_calls', 'logprobs': None} id='run-dfad5985-c34f-4c56-ab0f-7eec127e4419-0' tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'GDP of Missouri 2024'}, 'id': 'call_yHyeCHMR88aog66cjLdOYTYf'}] usage_metadata={'input_tokens': 1267, 'output_tokens': 68, 'total_tokens': 1335}
INFO:__main__:Calling: {'name': 'tavily_search_results_json', 'args': {'query': 'GDP of Missouri 2024'}, 'id': 'call_yHyeCHMR88aog66cjLdOYTYf'}


take_action called in thread: ThreadPoolExecutor-2_0
take_action called with tool_calls: [{'name': 'tavily_search_results_json', 'args': {'query': 'GDP of Missouri 2024'}, 'id': 'call_yHyeCHMR88aog66cjLdOYTYf'}]
Calling: {'name': 'tavily_search_results_json', 'args': {'query': 'GDP of Missouri 2024'}, 'id': 'call_yHyeCHMR88aog66cjLdOYTYf'}


INFO:__main__:action tavily_search_results_json, result: [{'url': 'https://usafacts.org/topics/economy/state/missouri/', 'content': "Real gross domestic product (GDP) Missouri's share of the US economy. Real gross domestic product (GDP) by industry. ... A majority of funding for the 2024 election — over 65%, or nearly $5.6 billion — comes from political action committees, also known as PACs. Published on May 17, 2024."}, {'url': 'https://www.bea.gov/data/gdp/gdp-state', 'content': 'Gross Domestic Product by State and Personal Income by State, 1st Quarter 2024. Real gross domestic product (GDP) increased in 39 states and the District of Columbia in the first quarter of 2024, with the percent change ranging from 5.0 percent at an annual rate in Idaho to -4.2 percent in South Dakota. Current Release. Current Release: June ...'}]
INFO:__main__:state: {'messages': [HumanMessage(content='Who won the super bowl in 2024? In what state is the winning team headquarters located? What is the GDP of that state? Answer each question.'), AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_r4Su82QJqD03HLQ2Anh5f6eG', 'function': {'arguments': '{"query": "Super Bowl 2024 winner"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}, {'id': 'call_uNfBjk7uNU7yuDj0HEkgIzsc', 'function': {'arguments': '{"query": "GDP of state where the Super Bowl 2024 winning team is located"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]}, response_metadata={'token_usage': {'completion_tokens': 70, 'prompt_tokens': 177, 'total_tokens': 247}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_298125635f', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-c9583580-7404-491a-9e08-69fab8c54719-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'Super Bowl 2024 winner'}, 'id': 'call_r4Su82QJqD03HLQ2Anh5f6eG'}, {'name': 'tavily_search_results_json', 'args': {'query': 'GDP of state where the Super Bowl 2024 winning team is located'}, 'id': 'call_uNfBjk7uNU7yuDj0HEkgIzsc'}], usage_metadata={'input_tokens': 177, 'output_tokens': 70, 'total_tokens': 247}), ToolMessage(content='[{\'url\': \'https://apnews.com/live/super-bowl-2024-updates\', \'content\': \'Throw in the fact that Chiefs coach Andy Reid will be in his fifth Super Bowl, the third most in NFL history, and has a chance to win a third ring, and the knowledge on the Kansas City sideline will be an advantage too big for the 49ers to overcome.\\n She performed in Japan on Saturday night before a flight across nine time zones and the international date line to reach the U.S.\\nRihanna performs during halftime of the NFL Super Bowl 57 football game between the Philadelphia Eagles and the Kansas City Chiefs, Sunday, Feb. 12, 2023, in Glendale, Ariz. (AP Photo/David J. Phillip)\\n After the teams take the field, Post Malone will perform “America the Beautiful” and Reba McEntire will sing “The Star-Spangled Banner.”\\nSan Francisco 49ers quarterback Brock Purdy (13) warms up before the NFL Super Bowl 58 football game against the Kansas City Chiefs, Sunday, Feb. 11, 2024, in Las Vegas. He was also the referee when the Chiefs beat the 49ers in the Super Bowl four years ago — and when the Rams beat the Saints in the 2019 NFC championship game after an infamous missed call.\\n Purdy’s comeback from the injury to his throwing arm suffered in last season’s NFC championship loss to the Philadelphia Eagles has been part of the storybook start to his career that started as Mr. Irrelevant as the 262nd pick in the 2022 draft.\\n\'}, {\'url\': \'https://www.cbssports.com/nfl/news/2024-super-bowl-chiefs-vs-49ers-score-patrick-mahomes-leads-ot-comeback-as-k-c-wins-back-to-back-titles/live/\', \'content\': "The championship-winning drive, which included a fourth-and-1 scramble from Mahomes and a clutch 7-yard catch from tight end Travis Kelce, was a must-score for K.C. The NFL\'s new playoff overtime rules -- both teams are guaranteed at least one possession in the extra period -- were in effect for the first time, and the Chiefs needed to answer the Niners\' field goal.\\n Held out of the end zone until that point, Kansas City grabbed its first lead of the game at 13-10.\\nJennings\' touchdown receiving (followed by a missed extra point) concluded a 75-yard drive that put the Niners back on top, 16-13, as the wideout joined former Philadelphia Eagles quarterback Nick Foles as the only players to throw and catch a touchdown in a Super Bowl.\\n He spread the ball around -- eight pass-catchers had at least two receptions -- slowly but surely overcoming a threatening 49ers defense that knocked him off his spot consistently in the first half.\\nMahomes, with his third Super Bowl MVP, now sits alongside Tom Brady (five) and Joe Montana (three) atop the mountain while becoming just the third player to win the award back-to-back, joining Bart Starr (I-II) and Terry Bradshaw (XIII-XIV).\\n The muffed punt that bounced off of cornerback Darrell Luter Jr.\'s ankle was also the big break that the Chiefs needed as they scored on the very next play to take the lead for the first time in the game. College Pick\'em\\nA Daily SportsLine Betting Podcast\\nNFL Playoff Time!\\n2024 Super Bowl, Chiefs vs. 49ers score: Patrick Mahomes leads OT comeback as K.C. wins back-to-back titles\\nCall it a dynasty; the Chiefs are the first team to win consecutive Super Bowls since 2003-04\\nThe Kansas City Chiefs are Super Bowl champions, again."}]', name='tavily_search_results_json', tool_call_id='call_r4Su82QJqD03HLQ2Anh5f6eG'), ToolMessage(content='[{\'url\': \'https://www.forbes.com/sites/jefffedotin/2024/06/03/super-bowl-lviii-generated-1-billion-economic-impact-for-las-vegas/\', \'content\': \'An average of 123.7 million watched the Kansas City Chiefs defeat the San Francisco 49ers in a 25-22, overtime classic on Super Bowl Sunday, but for Las Vegas, the economic impact started much ...\'}, {\'url\': \'https://www.rollingstone.com/culture/culture-features/2024-super-bowl-helping-las-vegas-economy-1234964688/\', \'content\': "The 2024 Super Bowl Is Helping Las Vegas\' Economy More Than Usual. big profits. Las Vegas Spent Decades Deprived of the Super Bowl. Now It Could Bring in $700 Million. After years of the NFL ..."}]', name='tavily_search_results_json', tool_call_id='call_uNfBjk7uNU7yuDj0HEkgIzsc'), AIMessage(content='1. The Kansas City Chiefs won the Super Bowl in 2024.\n2. The headquarters of the Kansas City Chiefs is located in Kansas City, Missouri.\n3. I will now look up the GDP of Missouri.', additional_kwargs={'tool_calls': [{'id': 'call_yHyeCHMR88aog66cjLdOYTYf', 'function': {'arguments': '{"query":"GDP of Missouri 2024"}', 'name': 'tavily_search_results_json'}, 'type': 'function', 'index': 0}]}, response_metadata={'token_usage': {'completion_tokens': 68, 'prompt_tokens': 1267, 'total_tokens': 1335}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d33f7b429e', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-dfad5985-c34f-4c56-ab0f-7eec127e4419-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'GDP of Missouri 2024'}, 'id': 'call_yHyeCHMR88aog66cjLdOYTYf'}], usage_metadata={'input_tokens': 1267, 'output_tokens': 68, 'total_tokens': 1335}), ToolMessage(content='[{\'url\': \'https://usafacts.org/topics/economy/state/missouri/\', \'content\': "Real gross domestic product (GDP) Missouri\'s share of the US economy. Real gross domestic product (GDP) by industry. ... A majority of funding for the 2024 election — over 65%, or nearly $5.6 billion — comes from political action committees, also known as PACs. Published on May 17, 2024."}, {\'url\': \'https://www.bea.gov/data/gdp/gdp-state\', \'content\': \'Gross Domestic Product by State and Personal Income by State, 1st Quarter 2024. Real gross domestic product (GDP) increased in 39 states and the District of Columbia in the first quarter of 2024, with the percent change ranging from 5.0 percent at an annual rate in Idaho to -4.2 percent in South Dakota. Current Release. Current Release: June ...\'}]', name='tavily_search_results_json', tool_call_id='call_yHyeCHMR88aog66cjLdOYTYf')]}


action tavily_search_results_json, result: [{'url': 'https://usafacts.org/topics/economy/state/missouri/', 'content': "Real gross domestic product (GDP) Missouri's share of the US economy. Real gross domestic product (GDP) by industry. ... A majority of funding for the 2024 election — over 65%, or nearly $5.6 billion — comes from political action committees, also known as PACs. Published on May 17, 2024."}, {'url': 'https://www.bea.gov/data/gdp/gdp-state', 'content': 'Gross Domestic Product by State and Personal Income by State, 1st Quarter 2024. Real gross domestic product (GDP) increased in 39 states and the District of Columbia in the first quarter of 2024, with the percent change ranging from 5.0 percent at an annual rate in Idaho to -4.2 percent in South Dakota. Current Release. Current Release: June ...'}]
Back to the model!


INFO:httpx:HTTP Request: POST https://api.chatanywhere.tech/v1/chat/completions "HTTP/1.1 200 OK"
INFO:__main__:LLM message: content="1. **Super Bowl 2024 Winner**: The Kansas City Chiefs won the Super Bowl in 2024.\n2. **Location of Winning Team's Headquarters**: The headquarters of the Kansas City Chiefs is located in Kansas City, Missouri.\n3. **GDP of Missouri**: The most recent data indicates that Missouri's GDP is detailed on the [Bureau of Economic Analysis (BEA) website](https://www.bea.gov/data/gdp/gdp-state). As of the first quarter of 2024, Missouri is part of the states where the real gross domestic product (GDP) increased, but specific figures for Missouri's GDP in 2024 were not provided in the search results. For precise and updated figures, you can check the BEA's latest release on state GDP." response_metadata={'token_usage': {'completion_tokens': 162, 'prompt_tokens': 1549, 'total_tokens': 1711}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d33f7b429e', 'finish_reason': 'stop', 'logprobs': None} id='run-3d28fe7f-51c1-40d1-85eb-45689a3cd2bd-0' usage_metadata={'input_tokens': 1549, 'output_tokens': 162, 'total_tokens': 1711}
INFO:__main__:exists_action result: content="1. **Super Bowl 2024 Winner**: The Kansas City Chiefs won the Super Bowl in 2024.\n2. **Location of Winning Team's Headquarters**: The headquarters of the Kansas City Chiefs is located in Kansas City, Missouri.\n3. **GDP of Missouri**: The most recent data indicates that Missouri's GDP is detailed on the [Bureau of Economic Analysis (BEA) website](https://www.bea.gov/data/gdp/gdp-state). As of the first quarter of 2024, Missouri is part of the states where the real gross domestic product (GDP) increased, but specific figures for Missouri's GDP in 2024 were not provided in the search results. For precise and updated figures, you can check the BEA's latest release on state GDP." response_metadata={'token_usage': {'completion_tokens': 162, 'prompt_tokens': 1549, 'total_tokens': 1711}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_d33f7b429e', 'finish_reason': 'stop', 'logprobs': None} id='run-3d28fe7f-51c1-40d1-85eb-45689a3cd2bd-0' usage_metadata={'input_tokens': 1549, 'output_tokens': 162, 'total_tokens': 1711}
print(result['messages'][-1].content)
1. **Super Bowl 2024 Winner**: The Kansas City Chiefs won the Super Bowl in 2024.
2. **Location of Winning Team's Headquarters**: The headquarters of the Kansas City Chiefs is located in Kansas City, Missouri.
3. **GDP of Missouri**: The most recent data indicates that Missouri's GDP is detailed on the [Bureau of Economic Analysis (BEA) website](https://www.bea.gov/data/gdp/gdp-state). As of the first quarter of 2024, Missouri is part of the states where the real gross domestic product (GDP) increased, but specific figures for Missouri's GDP in 2024 were not provided in the search results. For precise and updated figures, you can check the BEA's latest release on state GDP.
he first quarter of 2024, Missouri is part of the states where the real gross domestic product (GDP) increased, but specific figures for Missouri's GDP in 2024 were not provided in the search results. For precise and updated figures, you can check the BEA's latest release on state GDP.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1914363.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

uniapp微信小程序分享教程

文章目录 导文当前页面未设置分享&#xff1f;配置在代码中开启分享转发按钮 点击按钮转发怎么写微信小程序转发官网文档地址&#xff1a;uniapp转发官网文档地址&#xff1a; 导文 uniapp 微信小程序 当前页面未设置分享&#xff1f; uniapp 微信小程序分享到好友怎么写&#…

力扣-排序算法

排序算法&#xff0c;一般都可以使用std&#xff1a;&#xff1a;sort&#xff08;&#xff09;来快速排序。 这里介绍一些相关的算法&#xff0c;巩固记忆。 快速排序 跟二分查找有一丢丢像。 首先选择一个基准元素&#xff0c;一般就直接选择第一个。然后两个指针&#xff0c…

绝区玖--人工智能物料清单 (AI BOM)

前言 AI BOM 涵盖了从输入模型的数据到为模型提供支持的基础设施以及将 AI 从概念转化为生产的过程的一切。 但为什么我们需要人工智能物料清单&#xff1f;答案在于当今世界人工智能/Gen AI系统的复杂性和关键性&#xff1a; 透明度和可重复性&#xff1a;AI BOM 提供所有组件…

MES系统在装备制造行业核心应用场景介绍

MES软件在企业中有着广泛的应用场景&#xff0c;主要包括生产计划排程、生产过程监控、质量管理、设备管理、库存管理、数据分析等领域。 通过实时监控生产过程、收集数据、进行分析&#xff0c;MES软件可以帮助企业实现生产过程可视化、透明化&#xff0c;提高生产效率&#…

开源项目有哪些机遇与挑战

目录 1.概述 2.开源项目的发展趋势 2.1. 开源项目的发展现状 2.2. 开源社区的活跃度 2.3. 开源项目在技术创新中的作用 3.参与开源的经验分享 3.1. 选择开源项目 3.2. 理解项目结构和文档 3.3. 贡献代码 3.4. 与开源社区的合作 3.5. 学习和成长 4.开源项目的挑战 …

CSS【详解】文本相关样式(含 font 系列样式,文本颜色 color,三种颜色表示法,文本排版-含最佳实战范例,文本装饰,分散对齐,渐变色文本等)

文本风格 font-style font-style:italic 值描述normal默认值。浏览器显示一个标准的字体样式。italic加载对应字体的斜体字体文件&#xff0c;若找不到斜体字体文件&#xff0c;则进行物理上的倾斜。 标签默认font-style:italicoblique浏览器会显示一个倾斜的字体样式。 文本粗…

华为HCIP Datacom H12-821 卷33

1.判断题 缺省情况下&#xff0c;华为AR路由器的VRRP运行在抢占模式下 A、对 B、错 正确答案&#xff1a; A 解析&#xff1a; 无 2.判断题 一个Route-Policy下可以有多个节点&#xff0c;不同的节点号用节点号标识&#xff0c;不同节点之间的关系是"或"的关…

什么是 C 语言中的宏定义?

&#x1f345;关注博主&#x1f397;️ 带你畅游技术世界&#xff0c;不错过每一次成长机会&#xff01; &#x1f4d9;C 语言百万年薪修炼课程 通俗易懂&#xff0c;深入浅出&#xff0c;匠心打磨&#xff0c;死磕细节&#xff0c;6年迭代&#xff0c;看过的人都说好。 文章目…

告别缓慢下载,Cloudflare带你体验极速Docker镜像加速

背景 国内的Docker镜像服务似乎突然进入了寒冬&#xff0c;不仅Docker镜像服务受到了影响&#xff0c;连NPM镜像也可能面临下架的风险。这对依赖这些服务的开发者们来说&#xff0c;无疑是一个不小的困扰。 近日&#xff0c;SJTUG&#xff08;上海交通大学Linux用户组&#x…

Apache Hadoop之历史服务器日志聚集配置

上篇介绍了Apache Hadoop的分布式集群环境搭建&#xff0c;并测试了MapReduce分布式计算案例。但集群历史做了哪些任务&#xff0c;任务执行日志等信息还需要配置历史服务器和日志聚集才能更好的查看。 配置历史服务器 在Yarn中运行的任务产生的日志数据不能查看&#xff0c;…

30. 01背包问题 二维,01背包问题 一维,416.分割等和子集

背包问题分类&#xff1a; 1、确定dp数组以及下标的含义对于背包问题&#xff0c;有一种写法&#xff0c; 是使用二维数组&#xff0c;即dp[i][j] 表示从下标为[0-i]的物品里任意取&#xff0c;放进容量为j的背包&#xff0c;价值总和最大是多少。2、确定递推公式&#xff0c;…

硅谷甄选二(登录)

一、登录路由静态组件 src\views\login\index.vue <template><div class"login_container"><!-- Layout 布局 --><el-row><el-col :span"12" :xs"0"></el-col><el-col :span"12" :xs"2…

Qt基础控件总结—多页面切换(QStackWidget类、QTabBar类和QTabWidget类)

QStackedWidget 类 QStackedWidget 类是在 QStackedLayout 之上构造的一个便利的部件,其使用方法与步骤和 QStackedLayout 是一样的。QStackedWidget 类的成员函数与 QStackedLayout 类也基本上是一致的,使用该类就和使用 QStackedLayout 一样。 使用该类可以参考QStackedL…

施罗德数列SQL实现

在组合数学中,施罗德数用来描述从(0,0)到(n,n)的格路中,只能使用(1,0)、(0,1)、(1,1)三种移动方式,始终位于对角线下方且不越过对角线的路径数 DECLARE n INT 10 DECLARE i INT DECLARE rst INT DECLARE old INT1CREATE TABLE #rst (i INT ,rst int )INSERT INTO #rst values(…

Python 中创建当前日期和时间的文件名技巧详解

概要 在日常开发中,经常需要创建带有当前日期和时间的文件名,以便进行日志记录、数据备份或版本控制等操作。Python 提供了丰富的库和函数,可以方便地获取当前日期和时间,并将其格式化为字符串,用于生成文件名。本文将详细介绍如何使用 Python 创建带有当前日期和时间的文…

springboot大学生竞赛管理系统-计算机毕业设计源码37276

摘 要 随着教育信息化的不断发展&#xff0c;大学生竞赛已成为高校教育的重要组成部分。传统的竞赛组织和管理方式存在着诸多问题&#xff0c;如信息不透明、效率低下、管理不便等。为了解决这些问题&#xff0c;提高竞赛组织和管理效率&#xff0c;本文设计并实现了一个基于Sp…

STM32(二):STM32工作原理

0、参考1、寄存器和存储器基本概念&#xff08;1&#xff09;基本概念&#xff08;2&#xff09;主要区别&#xff08;3&#xff09;联系&#xff08;4&#xff09;实际应用中的案例&#xff08;5&#xff09;总结&#xff08;6&#xff09;一些名词解释 2、STM32指南者板子-存…

免费GPU——Google Colab使用

免费GPU——Google Colab使用 1、创建新的Notebook 网址&#xff1a;https://colab.research.google.com/ 点击“新建笔记本”进行创建 2、设置免费GPU 点击“更改运行时类型”&#xff0c;打开界面如下所示&#xff1a; 选择“T4 GPU”&#xff0c;然后“保存”即可使用…

秒速将油管视频转换为博客文章!

摘要&#xff1a; 本文提供了一个免费试用的分步指南&#xff0c;介绍如何在短时间内将YouTube视频内容转换为博客文章&#xff0c;以扩展网络营销效果。通过使用特定的模板和自动化工具&#xff0c;可以显著提高内容转换的效率。 关键词&#xff1a; YouTube视频&#xff0c;…

会员运营体系设计及SOP梳理

一些做会员的经验和方法分享给大家&#xff0c;包括顶层思考、流程的梳理、组织的建立&#xff0c;后续会做成系列&#xff0c;最近几期主要围绕顶层策略方面&#xff0c;以下是核心内容的整理&#xff1a; 1、会员运营体系设计 顶层设计与关键业务定位&#xff1a;建立客户运营…