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;
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// Batches: re-exported wholesale from async-openai (no Dynamo overrides).
29pub use async_openai::types::batches::*;
30
31// Files: re-exported wholesale from async-openai (no Dynamo overrides).
32pub use async_openai::types::files::*;
33
34// Images: re-exported wholesale from async-openai (no Dynamo overrides).
35pub use async_openai::types::images::*;
36
37// --- Convenience impls for locally-defined types ---
38mod impls;
39
40use crate::error::OpenAIError;
41use derive_builder::UninitializedFieldError;
42
43impl From<UninitializedFieldError> for OpenAIError {
44    fn from(value: UninitializedFieldError) -> Self {
45        OpenAIError::InvalidArgument(value.to_string())
46    }
47}