Skip to content

Commit

Permalink
fix(lab-3135): typing adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
paulruelle committed Sep 30, 2024
1 parent 1d5f214 commit 4617db4
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/kili/domain/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from enum import Enum
from typing import Any, Dict, Optional, Union

from typing_extensions import NotRequired, TypedDict
from typing_extensions import TypedDict


@dataclass
Expand Down Expand Up @@ -99,22 +99,30 @@ class ChatItemRole(str, Enum):
"""Enumeration of the supported chat item role."""

ASSISTANT = "ASSISTANT"
SYSTEM = "SYSTEM"
USER = "USER"


class CredentialsDict(TypedDict):
"""Dict that represents model.Credentials."""
class OpenAISDKCredentialsDict(TypedDict):
"""Dict that represents model.Credentials for OpenAI SDK."""

api_key: str
endpoint: str
deployment_id: NotRequired[str]


class AzureOpenAICredentialsDict(TypedDict):
"""Dict that represents model.Credentials for Azure OpenAI."""

api_key: str
endpoint: str
deployment_id: str


class ModelDict(TypedDict):
"""Dict that represents a Model."""

id: str
credentials: CredentialsDict
credentials: Union[AzureOpenAICredentialsDict, OpenAISDKCredentialsDict]
name: str
type: str

Expand Down

0 comments on commit 4617db4

Please sign in to comment.