diff --git a/simpletool/__init__.py b/simpletool/__init__.py index b99672c..2aeb669 100644 --- a/simpletool/__init__.py +++ b/simpletool/__init__.py @@ -40,7 +40,7 @@ async def execute(self, arguments: Dict[str, Any]) -> Union[List[Union[ImageCont # Fallback to default implementation raise NotImplementedError("Tool must implement either 'run' or 'execute' async method") - def _select_random_api_key(self, env_name:str, env_value: str) -> str: + def _select_random_api_key(self, env_name: str, env_value: str) -> str: """ Select random api key from env_value only if env_name contains 'API' and 'KEY' """ if 'API' in env_name.upper() and 'KEY' in env_name.upper(): api_keys = list(filter(bool, [key.strip() for key in env_value.split(',')])) diff --git a/simpletool/types.py b/simpletool/types.py index 1ae071a..36b9977 100644 --- a/simpletool/types.py +++ b/simpletool/types.py @@ -9,12 +9,14 @@ class Content(BaseModel): type: Literal["text", "image", "resource"] model_config = ConfigDict(extra="allow") + class TextContent(BaseModel): """Text content for a message.""" type: Literal["text"] text: str model_config = ConfigDict(extra="allow") + class ImageContent(BaseModel): """Image content for a message.""" type: Literal["image"] @@ -22,20 +24,24 @@ class ImageContent(BaseModel): mime_type: str = Field(alias="mimeType") model_config = ConfigDict(extra="allow") + class ResourceContents(BaseModel): """The contents of a resource, embedded into a prompt or tool call result.""" uri: AnyUrl mime_type: str | None = Field(None, alias="mimeType") model_config = ConfigDict(extra="allow") + class TextResourceContents(ResourceContents): """ Tee contents of a text resource, embedded into a prompt or tool call result.""" text: str + class BlobResourceContents(ResourceContents): """ The contents of a blob resource, embedded into a prompt or tool call result.""" blob: str + class EmbeddedResource(BaseModel): """ The contents of a resource, embedded into a prompt or tool call result. @@ -52,5 +58,5 @@ class ErrorData(BaseModel): """Error information for JSON-RPC error responses.""" code: int = Field(description="A number that indicates the error type that occurred.") message: str = Field(description="A short description of the error. The message SHOULD be limited to a concise single sentence.") - data: Any | None = Field(default=None, description="Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).") - model_config = ConfigDict(extra="allow") \ No newline at end of file + data: Any | None = Field(default=None, description="Additional information about the error.") + model_config = ConfigDict(extra="allow")