= yaml.load(f, Loader=yaml.FullLoader)json_spec = JsonSpec(dict_=data, max_value_length=4000)openapi_toolkit = OpenAPIToolkit.from_llm(    OpenAI(temperature=0), json_spec, openai_requests_wrapper, verbose=True)openapi_agent_executor = create_openapi_agent(    llm=OpenAI(temperature=0), toolkit=openapi_toolkit, verbose=True)openapi_agent_executor.run(    "Make a post request to openai /completions. The prompt should be 'tell me a joke.'")            > Entering new AgentExecutor chain...    Action: json_explorer    Action Input: What is the base url for the API?        > Entering new AgentExecutor chain...    Action: json_spec_list_keys    Action Input: data    Observation: ['openapi', 'info', 'servers', 'tags', 'paths', 'components', 'x-oaiMeta']    Thought: I should look at the servers key to see what the base url is    Action: json_spec_list_keys    Action Input: data["servers"][0]    Observation: ValueError('Value at path `data["servers"][0]` is not a dict, get the value directly.')    Thought: I should get the value of the servers key    Action: json_spec_get_value    Action Input: data["servers"][0]    Observation: {'url': 'https://api.openai.com/v1'}    Thought: I now know the base url for the API    Final Answer: The base url for the API is https://api.openai.com/v1        > Finished chain.        Observation: The base url for the API is https://api.openai.com/v1    Thought: I should find the path for the /completions endpoint.    Action: json_explorer    Action Input: What is the path for the /completions endpoint?        > Entering new AgentExecutor chain...    Action: json_spec_list_keys    Action Input: data    Observation: ['openapi', 'info', 'servers', 'tags', 'paths', 'components', 'x-oaiMeta']    Thought: I should look at the paths key to see what endpoints exist    Action: json_spec_list_keys    Action Input: data["paths"]    Observation: ['/engines', '/engines/{engine_id}', '/completions', '/chat/completions', '/edits', '/images/generations',
We can construct agents to consume arbitrary APIs, here APIs conformant to the OpenAPI/Swagger specification.
We can construct agents to consume arbitrary APIs, here APIs conformant to the OpenAPI/Swagger specification. ->: = yaml.load(f, Loader=yaml.FullLoader)json_spec = JsonSpec(dict_=data, max_value_length=4000)openapi_toolkit = OpenAPIToolkit.from_llm(    OpenAI(temperature=0), json_spec, openai_requests_wrapper, verbose=True)openapi_agent_executor = create_openapi_agent(    llm=OpenAI(temperature=0), toolkit=openapi_toolkit, verbose=True)openapi_agent_executor.run(    "Make a post request to openai /completions. The prompt should be 'tell me a joke.'")            > Entering new AgentExecutor chain...    Action: json_explorer    Action Input: What is the base url for the API?        > Entering new AgentExecutor chain...    Action: json_spec_list_keys    Action Input: data    Observation: ['openapi', 'info', 'servers', 'tags', 'paths', 'components', 'x-oaiMeta']    Thought: I should look at the servers key to see what the base url is    Action: json_spec_list_keys    Action Input: data["servers"][0]    Observation: ValueError('Value at path `data["servers"][0]` is not a dict, get the value directly.')    Thought: I should get the value of the servers key    Action: json_spec_get_value    Action Input: data["servers"][0]    Observation: {'url': 'https://api.openai.com/v1'}    Thought: I now know the base url for the API    Final Answer: The base url for the API is https://api.openai.com/v1        > Finished chain.        Observation: The base url for the API is https://api.openai.com/v1    Thought: I should find the path for the /completions endpoint.    Action: json_explorer    Action Input: What is the path for the /completions endpoint?        > Entering new AgentExecutor chain...    Action: json_spec_list_keys    Action Input: data    Observation: ['openapi', 'info', 'servers', 'tags', 'paths', 'components', 'x-oaiMeta']    Thought: I should look at the paths key to see what endpoints exist    Action: json_spec_list_keys    Action Input: data["paths"]    Observation: ['/engines', '/engines/{engine_id}', '/completions', '/chat/completions', '/edits', '/images/generations',