Skip to content

Commit

Permalink
Use import checks, unrelated small pydoc update
Browse files Browse the repository at this point in the history
  • Loading branch information
vblagoje committed Jun 27, 2024
1 parent 9d87ea5 commit dffa8ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("<your-tool-token>"))
credentials=Secret.from_env_var("FIRECRAWL_API_KEY"))
results = tool.run(messages=[ChatMessage.from_user("Scrape URL: https://news.ycombinator.com/")])
print(results)
Expand Down

0 comments on commit dffa8ae

Please sign in to comment.