> Finished chain.    ' The current temperature in Munich, Germany is 52.9¬∞F.'Note that we supply information about the API:open_meteo_docs.OPEN_METEO_DOCS[0:500]    'BASE URL: https://api.open-meteo.com/\n\nAPI Documentation\nThe API endpoint /v1/forecast accepts a geographical coordinate, a list of weather variables and responds with a JSON hourly weather forecast for 7 days. Time always starts at 0:00 today and contains 168 hours. All URL parameters are listed below:\n\nParameter\tFormat\tRequired\tDefault\tDescription\nlatitude, longitude\tFloating point\tYes\t\tGeographical WGS84 coordinate of the location\nhourly\tString array\tNo\t\tA list of weather variables which shou'Under the hood, we do two things:api_request_chain: Generate an API URL based on the input question and the api_docsapi_answer_chain: generate a final answer based on the API responseWe can look at the LangSmith trace to inspect this:The api_request_chain produces the API url from our question and the API documentation:Here we make the API request with the API url.The api_answer_chain takes the response from the API and provides us with a natural language response:Going deeper‚ÄãTest with other APIsimport osos.environ['TMDB_BEARER_TOKEN'] = ""from langchain.chains.api import tmdb_docsheaders = {"Authorization": f"Bearer {os.environ['TMDB_BEARER_TOKEN']}"}chain = APIChain.from_llm_and_api_docs(llm, tmdb_docs.TMDB_DOCS, headers=headers, verbose=True)chain.run("Search for 'Avatar'")import osfrom langchain.llms import OpenAIfrom langchain.chains.api import podcast_docsfrom langchain.chains import APIChain listen_api_key = 'xxx' # Get api key here: https://www.listennotes.com/api/pricing/llm = OpenAI(temperature=0)headers = {"X-ListenAPI-Key": listen_api_key}chain = APIChain.from_llm_and_api_docs(llm, podcast_docs.PODCAST_DOCS, headers=headers, verbose=True)chain.run("Search for 'silicon valley bank' podcast episodes, audio length is more than 30 minutes, return only 1 results")Web
Open In Colab
Open In Colab ->: > Finished chain.    ' The current temperature in Munich, Germany is 52.9¬∞F.'Note that we supply information about the API:open_meteo_docs.OPEN_METEO_DOCS[0:500]    'BASE URL: https://api.open-meteo.com/\n\nAPI Documentation\nThe API endpoint /v1/forecast accepts a geographical coordinate, a list of weather variables and responds with a JSON hourly weather forecast for 7 days. Time always starts at 0:00 today and contains 168 hours. All URL parameters are listed below:\n\nParameter\tFormat\tRequired\tDefault\tDescription\nlatitude, longitude\tFloating point\tYes\t\tGeographical WGS84 coordinate of the location\nhourly\tString array\tNo\t\tA list of weather variables which shou'Under the hood, we do two things:api_request_chain: Generate an API URL based on the input question and the api_docsapi_answer_chain: generate a final answer based on the API responseWe can look at the LangSmith trace to inspect this:The api_request_chain produces the API url from our question and the API documentation:Here we make the API request with the API url.The api_answer_chain takes the response from the API and provides us with a natural language response:Going deeper‚ÄãTest with other APIsimport osos.environ['TMDB_BEARER_TOKEN'] = ""from langchain.chains.api import tmdb_docsheaders = {"Authorization": f"Bearer {os.environ['TMDB_BEARER_TOKEN']}"}chain = APIChain.from_llm_and_api_docs(llm, tmdb_docs.TMDB_DOCS, headers=headers, verbose=True)chain.run("Search for 'Avatar'")import osfrom langchain.llms import OpenAIfrom langchain.chains.api import podcast_docsfrom langchain.chains import APIChain listen_api_key = 'xxx' # Get api key here: https://www.listennotes.com/api/pricing/llm = OpenAI(temperature=0)headers = {"X-ListenAPI-Key": listen_api_key}chain = APIChain.from_llm_and_api_docs(llm, podcast_docs.PODCAST_DOCS, headers=headers, verbose=True)chain.run("Search for 'silicon valley bank' podcast episodes, audio length is more than 30 minutes, return only 1 results")Web