Skip to content

Commit

Permalink
Avoid circular deps
Browse files Browse the repository at this point in the history
  • Loading branch information
vblagoje committed Jun 6, 2024
1 parent c8a80c1 commit 9c06a74
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion haystack_experimental/components/tools/openapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
11 changes: 1 addition & 10 deletions haystack_experimental/components/tools/openapi/_openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,6 +21,7 @@
cohere_converter,
openai_converter,
)
from haystack_experimental.components.tools.openapi.types import LLMProvider

VALID_HTTP_METHODS = [
"get",
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions haystack_experimental/components/tools/openapi/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from enum import Enum


class LLMProvider(Enum):
"""
Enum for the supported LLM providers.
"""
OPENAI = "openai"
ANTHROPIC = "anthropic"
COHERE = "cohere"

0 comments on commit 9c06a74

Please sign in to comment.