diff --git a/haystack_experimental/components/tools/openapi/__init__.py b/haystack_experimental/components/tools/openapi/__init__.py index f8774880..6867e62b 100644 --- a/haystack_experimental/components/tools/openapi/__init__.py +++ b/haystack_experimental/components/tools/openapi/__init__.py @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: Apache-2.0 -from haystack_experimental.components.tools.openapi._openapi import LLMProvider from haystack_experimental.components.tools.openapi.openapi_tool import OpenAPITool +from haystack_experimental.components.tools.openapi.types import LLMProvider __all__ = ["LLMProvider", "OpenAPITool"] diff --git a/haystack_experimental/components/tools/openapi/_openapi.py b/haystack_experimental/components/tools/openapi/_openapi.py index 990470cd..ed876de2 100644 --- a/haystack_experimental/components/tools/openapi/_openapi.py +++ b/haystack_experimental/components/tools/openapi/_openapi.py @@ -6,7 +6,6 @@ import logging import os from dataclasses import dataclass, field -from enum import Enum from pathlib import Path from typing import Any, Callable, Dict, List, Literal, Optional, Union from urllib.parse import urlparse @@ -22,6 +21,7 @@ cohere_converter, openai_converter, ) +from haystack_experimental.components.tools.openapi.types import LLMProvider VALID_HTTP_METHODS = [ "get", @@ -37,15 +37,6 @@ logger = logging.getLogger(__name__) -class LLMProvider(Enum): - """ - Enum for the supported LLM providers. - """ - OPENAI = "openai" - ANTHROPIC = "anthropic" - COHERE = "cohere" - - def is_valid_http_url(url: str) -> bool: """ Check if a URL is a valid HTTP/HTTPS URL. diff --git a/haystack_experimental/components/tools/openapi/openapi_tool.py b/haystack_experimental/components/tools/openapi/openapi_tool.py index ea9f4787..de5062d3 100644 --- a/haystack_experimental/components/tools/openapi/openapi_tool.py +++ b/haystack_experimental/components/tools/openapi/openapi_tool.py @@ -10,12 +10,12 @@ from haystack.components.generators.chat import OpenAIChatGenerator from haystack.dataclasses import ChatMessage, ChatRole from haystack.lazy_imports import LazyImport -from haystack_experimental.components.tools.openapi import LLMProvider from haystack_experimental.components.tools.openapi._openapi import ( ClientConfiguration, OpenAPIServiceClient, ) +from haystack_experimental.components.tools.openapi.types import LLMProvider with LazyImport("Run 'pip install anthropic-haystack'") as anthropic_import: # pylint: disable=import-error diff --git a/haystack_experimental/components/tools/openapi/types.py b/haystack_experimental/components/tools/openapi/types.py new file mode 100644 index 00000000..ed2a2c99 --- /dev/null +++ b/haystack_experimental/components/tools/openapi/types.py @@ -0,0 +1,10 @@ +from enum import Enum + + +class LLMProvider(Enum): + """ + Enum for the supported LLM providers. + """ + OPENAI = "openai" + ANTHROPIC = "anthropic" + COHERE = "cohere"