feat(multi modaility):

This commit is contained in:
Alexander Myasoedov
2025-01-14 11:25:50 +02:00
parent b6db40c5ae
commit 7c0d6f7eae
4 changed files with 55 additions and 4 deletions
+16
View File
@@ -1,9 +1,17 @@
import base64
from enum import Enum
import httpx
from pydantic import BaseModel
class Modality(Enum):
TEXT = 0
IMAGE = 1
AUDIO = 2
FILES = 3
def encode_image_base64_by_url(url: str = "https://github.com/fluidicon.png") -> str:
"""Encode image data to base64 from a URL"""
response = httpx.get(url)
@@ -110,6 +118,14 @@ class LLMSpec(BaseModel):
fn = probe
@property
def modality(self) -> Modality:
if self.has_image:
return Modality.IMAGE
if self.has_audio:
return Modality.AUDIO
return Modality.TEXT
def parse_http_spec(http_spec: str) -> LLMSpec:
"""Parses an HTTP specification string into a LLMSpec object.