langchain.chains.openai_functions.openapi.get_openapi_chain¶
langchain.chains.openai_functions.openapi.get_openapi_chain(spec: Union[OpenAPISpec, str], llm: Optional[BaseLanguageModel] = None, prompt: Optional[BasePromptTemplate] = None, request_chain: Optional[Chain] = None, llm_chain_kwargs: Optional[Dict] = None, verbose: bool = False, headers: Optional[Dict] = None, params: Optional[Dict] = None, **kwargs: Any) → SequentialChain[source]¶
Create a chain for querying an API from a OpenAPI spec.
Parameters
spec – OpenAPISpec or url/file/text string corresponding to one.
llm – language model, should be an OpenAI function-calling model, e.g.
ChatOpenAI(model=”gpt-3.5-turbo-0613”).
prompt – Main prompt template to use.
request_chain – Chain for taking the functions output and executing the request.
Examples using get_openapi_chain¶
Set env var OPENAI_API_KEY or load from a .env file: