diff --git a/haystack_experimental/components/tools/openapi/_schema_conversion.py b/haystack_experimental/components/tools/openapi/_schema_conversion.py index 30595656..1d0766a5 100644 --- a/haystack_experimental/components/tools/openapi/_schema_conversion.py +++ b/haystack_experimental/components/tools/openapi/_schema_conversion.py @@ -27,6 +27,7 @@ def openai_converter(schema: OpenAPISpecification) -> List[Dict[str, Any]]: :param schema: The OpenAPI specification to convert. :returns: A list of dictionaries, each dictionary representing an OpenAI function definition. """ + jsonref_import.check() resolved_schema = jsonref.replace_refs(schema.spec_dict) fn_definitions = _openapi_to_functions( resolved_schema, "parameters", _parse_endpoint_spec_openai @@ -43,6 +44,7 @@ def anthropic_converter(schema: OpenAPISpecification) -> List[Dict[str, Any]]: :param schema: The OpenAPI specification to convert. :returns: A list of dictionaries, each dictionary representing Anthropic function definition. """ + jsonref_import.check() resolved_schema = jsonref.replace_refs(schema.spec_dict) return _openapi_to_functions( resolved_schema, "input_schema", _parse_endpoint_spec_openai @@ -58,6 +60,7 @@ def cohere_converter(schema: OpenAPISpecification) -> List[Dict[str, Any]]: :param schema: The OpenAPI specification to convert. :returns: A list of dictionaries, each representing a Cohere style function definition. """ + jsonref_import.check() resolved_schema = jsonref.replace_refs(schema.spec_dict) return _openapi_to_functions( resolved_schema, "not important for cohere", _parse_endpoint_spec_cohere diff --git a/haystack_experimental/components/tools/openapi/openapi_tool.py b/haystack_experimental/components/tools/openapi/openapi_tool.py index 33c64d4a..bddaf65d 100644 --- a/haystack_experimental/components/tools/openapi/openapi_tool.py +++ b/haystack_experimental/components/tools/openapi/openapi_tool.py @@ -47,7 +47,7 @@ class OpenAPITool: tool = OpenAPITool(generator_api=LLMProvider.OPENAI, generator_api_params={"model":"gpt-3.5-turbo"}, spec="https://raw.githubusercontent.com/mendableai/firecrawl/main/apps/api/openapi.json", - credentials=Secret.from_token("")) + credentials=Secret.from_env_var("FIRECRAWL_API_KEY")) results = tool.run(messages=[ChatMessage.from_user("Scrape URL: https://news.ycombinator.com/")]) print(results)