Builds OpenAI chat request payloads, handling tool definitions, encrypted content size limits, and logging for provider integrations.
// Source: https://github.com/1jehuang/jcode | License: MIT | Copyright 2025 Jeremy Huang
// Provided via justclaw.it.com; keep this notice with the code.
use jcode_message_types::{
ContentBlock, Message as ChatMessage, Role, TOOL_OUTPUT_MISSING_TEXT, ToolDefinition,
sanitize_tool_id,
};
use jcode_provider_core::openai_schema::{
openai_compatible_schema, schema_supports_strict, strict_normalize_schema,
};
use serde_json::Value;
use std::collections::{HashMap, HashSet};
use std::sync::atomic::{AtomicU64, Ordering};
static REWRITTEN_ORPHAN_TOOL_OUTPUTS: AtomicU64 = AtomicU64::new(0);
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum OpenAiRequestLogLevel {
Info,
Warn,
}
/// OpenAI rejects `input[*].encrypted_content` strings above this size.
pub const OPENAI_ENCRYP
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key