diff --git a/docs/extras/modules/chains/additional/openapi_openai.ipynb b/docs/extras/modules/chains/additional/openapi_openai.ipynb index 90bdf10015f..97ec9c7a147 100644 --- a/docs/extras/modules/chains/additional/openapi_openai.ipynb +++ b/docs/extras/modules/chains/additional/openapi_openai.ipynb @@ -20,18 +20,10 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "08e19b64", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Attempting to load an OpenAPI 3.0.1 spec. This may result in degraded performance. Convert your OpenAPI spec to 3.1.* spec for better support.\n" - ] - } - ], + "outputs": [], "source": [ "from langchain.chains.openai_functions.openapi import get_openapi_chain\n", "\n", @@ -103,19 +95,10 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "bf6cd695", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Attempting to load an OpenAPI 3.0.1 spec. This may result in degraded performance. Convert your OpenAPI spec to 3.1.* spec for better support.\n", - "Attempting to load an OpenAPI 3.0.1 spec. This may result in degraded performance. Convert your OpenAPI spec to 3.1.* spec for better support.\n" - ] - } - ], + "outputs": [], "source": [ "chain = get_openapi_chain(\"https://api.speak.com/openapi.yaml\")" ] @@ -152,18 +135,10 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "a9198f62", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Attempting to load an OpenAPI 3.0.0 spec. This may result in degraded performance. Convert your OpenAPI spec to 3.1.* spec for better support.\n" - ] - } - ], + "outputs": [], "source": [ "chain = get_openapi_chain(\"https://gist.githubusercontent.com/roaldnefs/053e505b2b7a807290908fe9aa3e1f00/raw/0a212622ebfef501163f91e23803552411ed00e4/openapi.yaml\")" ] diff --git a/langchain/chains/openai_functions/openapi.py b/langchain/chains/openai_functions/openapi.py index 63ae84f00e3..57574ab6a5f 100644 --- a/langchain/chains/openai_functions/openapi.py +++ b/langchain/chains/openai_functions/openapi.py @@ -207,6 +207,15 @@ def get_openapi_chain( prompt: Optional[BasePromptTemplate] = None, request_chain: Optional[Chain] = None, ) -> SequentialChain: + """Create a chain for querying an API from a OpenAPI spec. + + Args: + 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. + """ if isinstance(spec, str): for conversion in ( OpenAPISpec.from_url,