osyra.resources.chat
``client.chat.completions.create(...)`` — the OpenAI-shaped Chat surface.
Builds the exact OpenAI ``/v1/chat/completions`` JSON body, sends it via the client's httpx transport to the OSYRA edge, and parses the response into typed ``ChatCompletion`` / ``ChatCompletionChunk`` objects.
Wire shape: the request body is OpenAI-shaped JSON. Edge's verified behavioral subset is model, string-content messages, max_tokens, temperature, top_p, stop, stream, and stream_options.include_usage. The serializer preserves additional OpenAI-shaped fields for source/wire compatibility, but Edge currently ignores unknown fields; serialization is not a claim that those behaviors are honored. The three Osyra extras are projected onto ``X-Osyra-*`` headers, never the body.
Classes
class Chat
``client.chat`` — owns the ``completions`` sub-resource.
Methods
__init__
def __init__(self, client: 'OpenAI') -> Noneclass Completions
Methods
__init__
def __init__(self, client: 'OpenAI') -> Nonecreate
def create(self, *, model: str, messages: List[Dict[str, Any]], stream: bool = False, **kwargs: Any) -> Union[ChatCompletion, ChatCompletionStream]Create a chat completion.
Edge guarantees ``model``, string-content ``messages``, ``max_tokens``, ``temperature``, ``top_p``, ``stop`` (string array), ``stream``, and ``stream_options.include_usage``. Additional OpenAI-shaped kwargs are serialized for compatibility but are not guaranteed to affect inference. The three Osyra extras become headers. Set ``stream=True`` to receive a ``ChatCompletionStream`` iterator yielding ``ChatCompletionChunk``.