Skip to main content

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;
13pub mod decisions;
14mod embeddings;
15pub mod realtime;
16pub mod responses;
17pub mod systemone;
18
19// --- Local type re-exports ---
20pub use chat::*;
21pub use completion::*;
22
23// Embeddings: `Embedding` and `CreateEmbeddingResponse` are owned
24// locally (in the `embeddings` submodule) so a per-input embedding
25// can be either a float vector or a base64 string per the OpenAI
26// `encoding_format` spec. Every other embedding type is still
27// re-exported from `async_openai::types::embeddings::*`.
28pub use embeddings::*;
29
30// Batches: re-exported wholesale from async-openai (no Dynamo overrides).
31pub use async_openai::types::batches::*;
32
33// Files: re-exported wholesale from async-openai (no Dynamo overrides).
34pub use async_openai::types::files::*;
35
36// Images: re-exported wholesale from async-openai (no Dynamo overrides).
37pub use async_openai::types::images::*;
38
39// --- Convenience impls for locally-defined types ---
40mod impls;
41
42use crate::error::OpenAIError;
43use derive_builder::UninitializedFieldError;
44
45impl From<UninitializedFieldError> for OpenAIError {
46    fn from(value: UninitializedFieldError) -> Self {
47        OpenAIError::InvalidArgument(value.to_string())
48    }
49}