sambanova_client

Classes

SambaNovaClient([api_key, ...])

A component wrapper for SambaNova's OpenAI-compatible API.

class SambaNovaClient(api_key: str | None = None, chat_completion_parser: Callable[[Completion], Any] = None, input_type: Literal['text', 'messages'] = 'text', base_url: str = 'https://api.sambanova.ai/v1/', env_api_key_name: str = 'SAMBANOVA_API_KEY')[source]

Bases: OpenAIClient

A component wrapper for SambaNova’s OpenAI-compatible API.

This client extends OpenAIClient and customizes:
  • The API key is read from the environment variable SAMBANOVA_API_KEY if not provided explicitly.

Example usage with the AdalFlow Generator:

from adalflow.core import Generator
from adalflow.components.model_client.sambanova_client import SambaNovaClient

generator = Generator(
    model_client=SambaNovaClient(),
    model_kwargs={
        "model": "Meta-Llama-3.1-8B-Instruct",
        "temperature": 0.7,
        "top_p": 0.9,
    },
)

prompt_kwargs = {
    "input_str": "Hello from SambaNova! Can you summarize the concept of quantum computing in simple terms?"
}

response = generator(prompt_kwargs)