Buckets:

download
raw
1.44 kB
"""Base LLM provider interface."""
from abc import ABC, abstractmethod
from typing import Any
class BaseLLMProvider(ABC):
"""Base class for LLM providers."""
@abstractmethod
def generate(
self,
prompt: str,
system: str | None = None,
temperature: float = 0.7,
max_tokens: int | None = None,
**kwargs: Any,
) -> str:
"""Generate text completion.
Args:
prompt: Input prompt
system: Optional system message
temperature: Sampling temperature (0.0-1.0)
max_tokens: Maximum tokens to generate
**kwargs: Additional model-specific parameters
Returns:
Generated text
"""
pass
@abstractmethod
def stream(self, prompt: str, system: str | None = None, temperature: float = 0.7, **kwargs: Any) -> Any:
"""Stream text generation."""
pass
@abstractmethod
async def async_generate(
self,
prompt: str,
system: str | None = None,
temperature: float = 0.7,
max_tokens: int | None = None,
**kwargs: Any,
) -> str:
"""Generate text completion (async)."""
pass
@abstractmethod
async def async_stream(
self, prompt: str, system: str | None = None, temperature: float = 0.7, **kwargs: Any
) -> Any:
"""Stream text generation (async)."""
pass

Xet Storage Details

Size:
1.44 kB
·
Xet hash:
c746120efd530bc3f824304bef450130a15b09fb690f3fa63251594b92cfccc6

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.