ExAgent.Services.OpenAICompatibleService (ExAgent v0.4.1)

Copy Markdown View Source

HTTP service for OpenAI-compatible chat endpoints (vLLM, OpenRouter, Together, Groq, ...).

Request and response shaping is shared with the other dialect speakers via an internal OpenAIDialect helper. What differs here is attachment delivery: these endpoints have no Files API, so bytes always become data: URIs and media is carried in image_url / video_url / audio_url content parts.

Summary

Functions

Sends a chat completion request to an OpenAI-compatible endpoint.

Streams a chat completion as a lazy enumerable of text chunks.

Functions

chat(provider, messages, opts \\ [])

@spec chat(ExAgent.Providers.OpenAICompatible.t(), [ExAgent.Message.t()], keyword()) ::
  {:ok, Response.t()} | {:tool_calls, [map()]} | {:error, ExAgent.Error.t()}

Sends a chat completion request to an OpenAI-compatible endpoint.

stream(provider, messages, opts \\ [])

Streams a chat completion as a lazy enumerable of text chunks.