dynamo_protocols/types/mod.rs
1// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0
3//
4// Types used in inference API requests and responses.
5//
6// Base OpenAI types are re-exported from upstream async-openai.
7// Inference-serving extensions and Anthropic types are locally defined.
8
9// --- Locally defined modules ---
10pub mod anthropic;
11mod chat;
12mod completion;
13mod embeddings;
14pub mod realtime;
15pub mod responses;
16
17// --- Local type re-exports ---
18pub use chat::*;
19pub use completion::*;
20
21// Embeddings: `Embedding` and `CreateEmbeddingResponse` are owned
22// locally (in the `embeddings` submodule) so a per-input embedding
23// can be either a float vector or a base64 string per the OpenAI
24// `encoding_format` spec. Every other embedding type is still
25// re-exported from `async_openai::types::embeddings::*`.
26pub use embeddings::*;
27
28// Images: re-exported wholesale from async-openai (no Dynamo overrides).
29pub use async_openai::types::images::*;
30
31// --- Convenience impls for locally-defined types ---
32mod impls;
33
34use crate::error::OpenAIError;
35use derive_builder::UninitializedFieldError;
36
37impl From<UninitializedFieldError> for OpenAIError {
38 fn from(value: UninitializedFieldError) -> Self {
39 OpenAIError::InvalidArgument(value.to_string())
40 }
41}