DeepSeek-V3/experimental/src/web/openai.zig
Triex 31ef81000f feat: Migrate experimental implementation to modern Zig, achieve clean compilation (private repo dump -> /experimental)
- Port HTTP server, and appropriate points across core etc from old API to Zig `0.15.0-dev` patterns
- Fix mutability, unused variables, and API compatibility issues
- Validate SIMD tensor operations and backend architecture
- Foundation now compiles cleanly and produces working binary
2025-06-06 15:31:21 +10:00

57 lines
1.2 KiB
Zig

const std = @import("std");
// OpenAI API compatible structures
/// Chat completion request
pub const ChatCompletionRequest = struct {
model: []const u8,
messages: []Message,
max_tokens: ?u32 = null,
temperature: ?f32 = null,
top_p: ?f32 = null,
stream: ?bool = null,
};
/// Chat message
pub const Message = struct {
role: []const u8, // "system", "user", "assistant"
content: []const u8,
};
/// Chat completion response
pub const ChatCompletionResponse = struct {
id: []const u8,
object: []const u8, // "chat.completion"
created: i64,
model: []const u8,
choices: []Choice,
usage: Usage,
};
/// Choice in completion response
pub const Choice = struct {
index: u32,
message: Message,
finish_reason: []const u8, // "stop", "length", "content_filter"
};
/// Token usage information
pub const Usage = struct {
prompt_tokens: u32,
completion_tokens: u32,
total_tokens: u32,
};
/// Models list response
pub const ModelsResponse = struct {
object: []const u8, // "list"
data: []ModelInfo,
};
/// Model information
pub const ModelInfo = struct {
id: []const u8,
object: []const u8, // "model"
created: i64,
owned_by: []const u8,
};