L2 LangGraph_Components

参考自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 = systemgraph = 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) > 0def call_openai(self, state: AgentState):logger.info(f"state: {state}")messages = state['messages']if self.system:messages = [SystemMessage(content=self.system)] + messagesmessage = self.model.invoke(messages)logger.info(f"LLM message: {message}")return {'messages': [message]}def take_action(self, state: AgentState):import threadingprint(f"take_action called in thread: {threading.current_thread().name}")tool_calls = state['messages'][-1].tool_callsresults = []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 LLMprint("\n ....bad tool name....")result = "bad tool name, retry"  # instruct LLM to retry if badelse: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 ImageImage(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.mzph.cn/web/43075.shtml

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

相关文章

2024年高压电工证考试题库及高压电工试题解析

题库来源&#xff1a;安全生产模拟考试一点通公众号小程序 2024年高压电工证考试题库及高压电工试题解析是安全生产模拟考试一点通结合&#xff08;安监局&#xff09;特种作业人员操作证考试大纲和&#xff08;质检局&#xff09;特种设备作业人员上岗证考试大纲随机出的高压…

uniapp vue3微信小程序如何获取dom元素

在网上很多人说可以通过下面两种形式获取到指定dom元素 // 定义ref <div ref"box"></div>//1通过this.$refs获取dom元素 this.$refs.box//2通过ref(null)获取dom元素 let box ref(null)第一种方式在vue2中是可以获取到的&#xff0c;但是在vue3 setup中…

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

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

内裤洗衣机到底值不值得买?五大高质量靠谱内衣洗衣机值得拥有

市场上出现了内衣洗衣机&#xff0c;这种洗衣机比市面上的普通洗衣机的清洁力好&#xff0c;还具有除菌功能&#xff0c;在清洗完内衣裤的过程中&#xff0c;可以将衣物上的细菌去除掉&#xff0c;但市面上的内衣品牌众多&#xff0c;什么样的牌子才好用呢&#xff1f;作为一位…

前端简历:如何写项目经历(经验)找出细节点和重难点,轻松应对面试?

&#xff08;下面内容&#xff1a;我将结合我的实际项目带大家进行每一步骤的梳理&#xff09; 项目经历-堂食外送点餐 2022年2月-2022年5月 项目描述&#xff1a;该平台提供外送订餐服务&#xff0c;用户可以在手机中轻松地浏览菜品、下单、支付、编辑地址、填写个人信息等…

手撸俄罗斯方块——游戏设计

手撸俄罗斯方块——游戏设计 概述 上一章我们介绍俄罗斯方块的基本信息&#xff0c;包括坐标点和方块的基本概念&#xff0c;这一章节我们继续介绍如何完成后续的游戏设计。 组成游戏的基本要素 俄罗斯方块作为一个 2D 的平面游戏&#xff0c;我们可以将整个参与元素做如下…

简过网:工程专业最吃香的6个证书,你考了几个了?

工程专业最吃香的6个证书&#xff0c;你考了几个了&#xff1f;我们一起来看看吧&#xff01; 1、二级建造师 报考条件&#xff1a;工程类大专及以上学历/从事相关职业 考试时间&#xff1a;3月报名、6月考试 就业前景&#xff1a;建筑设计院、房产开发公司、施工单位 2、一…

如何管理一百个ai专家智能体——ai调度系统设计

前言 如果你用过openai的chatgpt服务&#xff0c;你肯定知道一个叫做GPTs的智能体商店&#xff0c;里面提供了大量的来自官方和个人制作的专门针对某个领域的gpt助手。比如&#xff0c;你想让gpt帮忙写文章&#xff0c;并且要能够写得好&#xff0c;你就可以在商店中搜索相关的…

【C语言】符号优先级详解

C语言符号优先级详细解析 在C语言中&#xff0c;不同的运算符具有不同的优先级和结合性&#xff0c;这决定了在表达式中运算符的计算顺序。理解这些优先级和结合性是正确编写和理解C语言程序的基础。本文将详细解析C语言中的符号优先级&#xff0c;包括各类运算符的优先级、结…

Smail语句如何使用判断语句跳过验证卡密界面?谈谈思路

&#x1f3c6;本文收录于《CSDN问答解惑》专栏&#xff0c;主要记录项目实战过程中的Bug之前因后果及提供真实有效的解决方案&#xff0c;希望能够助你一臂之力&#xff0c;帮你早日登顶实现财富自由&#x1f680;&#xff1b;同时&#xff0c;欢迎大家关注&&收藏&…

数据融合工具(5)面中心线提取

这是一个重磅工具&#xff0c;建议先看视频。 提取中心线 一、需求背景 说真的&#xff0c;当小编第一次使用ArcGIS中的Polygon To Centerline工具提取面要素中心线时&#xff0c;激动得无以言表&#xff0c;毕竟&#xff0c;以前要提取面中心线&#xff0c;是一件非常麻烦的事…

uniapp图片压缩之后在上传

压缩图片js方法&#xff0c;新建imgPress.js /** * H5压缩 二分查找算法来找到一个合适的图像质量系数&#xff0c;使得压缩后的图片文件大小接近于目标大小* param {Object} imgSrc 图片url * param {Object} callback 回调设置返回值 * */ export function compressH5(fileI…

nginx热更新详解及实战操作

Nginx热更新&#xff0c;也被称为平滑升级或热部署&#xff0c;是指在不中断Nginx服务的情况下&#xff0c;对Nginx进行升级或更新其配置&#xff0c;以实现业务的无损和用户无感知的升级过程。以下是关于Nginx热更新的详细解释&#xff1a; 一、Nginx热更新的原理 Nginx热更…

Kubernetes APIServer 几种基本认证方式

"认证"&#xff0c;形象地理解就是"你是谁"。在上文中&#xff0c;用户A在发起API请求时&#xff0c;管理员如何道该请求是用户A发起的呢&#xff1f;所以&#xff0c;客户端在发起API请求时&#xff0c;必须要携带一个身份信息来表明"我是谁"&a…

泰勒公式中拉格朗日余项和佩亚诺余项的区别及具体的应用场景案例

泰勒公式是微积分中的一个重要工具&#xff0c;用于将一个函数在某一点附近展开成多项式形式&#xff0c;以便于近似计算和分析。泰勒公式的一般形式为&#xff1a; f ( x ) f ( a ) f ′ ( a ) ( x − a ) f ′ ′ ( a ) 2 ! ( x − a ) 2 ⋯ f ( n ) ( a ) n ! ( x − a…

[CTF]-PWN:House of Cat堆题型综合解析

原理&#xff1a; 调用顺序&#xff1a; exit->_IO_wfile_jumps->_IO_wfile_seekoff->_IO_switch_to_wget_mode _IO_wfile_seekoff源码&#xff1a; off64_t _IO_wfile_seekoff (FILE *fp, off64_t offset, int dir, int mode) {off64_t result;off64_t delta, new…

AI绘画小白必备!Stable Diffusion常用插件合集,好用推荐!(附插件下载)

前言 宝子们&#xff0c;早上好啊~Stable Diffusion 常用插件&#xff0c;月月已经给大家整理好了&#xff0c;自取就好。 拥有这些SD常用插件&#xff0c;让您的图像生成和编辑过程更加强大、直观、多样化。以下插件集成了一系列增强功能&#xff0c;覆盖从自动补全提示词到…

开源项目:驱动创新与协作的时代引擎

《开源项目&#xff1a;驱动创新与协作的时代引擎》 在当今全球经济与科技环境瞬息万变的背景下&#xff0c;开源软件项目如同一颗璀璨的新星&#xff0c;在开发者社区的天空中熠熠生辉。其蓬勃发展的态势不仅成为了热门话题&#xff0c;更是引领着技术领域的变革潮流。 开源…

无法访问。你可能没有权限使用网络资源。请与这台服务器的管理员联系以查明你是否有访问权限。【解决办法】

问题描述 新建好一台windows虚拟机&#xff0c;两台设备网络是互通的&#xff0c;但是物理机在访问虚拟机的网络共享文件资源时&#xff0c;出现图下所示的报错&#xff1a;XXX无法访问。你可能没有权限使用网络资源。请与这台服务器的管理员联系以查明你是否有访问权限。用户…

echarts无法加载Map地图的问题

项目场景&#xff1a; echarts无法加载Map地图的问题 详情 查阅相关资料讲&#xff0c;echarts4.9以上版本已经移除了map&#xff0c;那么我们就得重新打包echarts文件了。打包echarts.min.js的链接&#xff1a;https://echarts.apache.org/zh/builder.html 在这个链接页面可…