pub type OpenRouter = GenericOpenAI<OpenRouterConfig>;
open-router
only.Expand description
The OpenRouter
struct encapsulates an OpenRouter
client and default options for embedding
and prompt models. It uses the Builder
pattern for flexible and customizable instantiation.
By default it will look for a OPENROUTER_API_KEY
environment variable. Note that either a
prompt model or embedding model always need to be set, either with
OpenRouter::with_default_prompt_model
or OpenRouter::with_default_embed_model
or via the
builder. You can find available models in the OpenRouter
documentation.
Under the hood it uses async_openai
, with the OpenRouter
openai compatible api. This means
some features might not work as expected. See the OpenRouter
documentation for details.
Aliased Type§
pub struct OpenRouter {
pub stream_full: bool,
/* private fields */
}
Fields§
§stream_full: bool
Convenience option to stream the full response. Defaults to true, because nobody has time to reconstruct the delta. Disabling this will make the streamed content only return the delta, for when performance matters. This only has effect when streaming is enabled.
Implementations§
Source§impl OpenRouter
impl OpenRouter
Sourcepub fn builder() -> OpenRouterBuilder
pub fn builder() -> OpenRouterBuilder
Creates a new OpenRouterBuilder
for constructing OpenRouter
instances.