From 5de700310472fb7b1cd0ac74efd76a79392025d5 Mon Sep 17 00:00:00 2001 From: Vladimir Blagojevic Date: Tue, 18 Jun 2024 15:31:19 +0200 Subject: [PATCH] Final touches --- .../components/tools/openapi/openapi_tool.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/haystack_experimental/components/tools/openapi/openapi_tool.py b/haystack_experimental/components/tools/openapi/openapi_tool.py index 7f412544..2b5dd876 100644 --- a/haystack_experimental/components/tools/openapi/openapi_tool.py +++ b/haystack_experimental/components/tools/openapi/openapi_tool.py @@ -44,8 +44,8 @@ class OpenAPITool: tool = OpenAPITool(generator_api=LLMProvider.OPENAI, generator_api_params={"model":"gpt-3.5-turbo"}, - tool_spec="https://raw.githubusercontent.com/mendableai/firecrawl/main/apps/api/openapi.json", - tool_credentials="") + spec="https://raw.githubusercontent.com/mendableai/firecrawl/main/apps/api/openapi.json", + credentials=Secret.from_token("")) results = tool.run(messages=[ChatMessage.from_user("Scrape URL: https://news.ycombinator.com/")]) print(results) @@ -167,6 +167,12 @@ def _init_generator(self, generator_api: LLMProvider, generator_api_params: Dict raise ValueError(f"Unsupported generator API: {generator_api}") def _create_openapi_spec(self, openapi_spec: Union[Path, str]) -> OpenAPISpecification: + """ + Create an OpenAPISpecification object from the provided OpenAPI specification. + + :param openapi_spec: OpenAPI specification for the tool/service. This can be a URL, a local file path, or + an OpenAPI service specification provided as a string. + """ if isinstance(openapi_spec, (str, Path)) and os.path.isfile(openapi_spec): return OpenAPISpecification.from_file(openapi_spec) if isinstance(openapi_spec, str):