Converts DocumentContent into provider-specific JSON and checks supported MIME types.
// Source: https://github.com/aaif-goose/goose | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
use serde_json::{json, Value};
use crate::conversation::message::DocumentContent;
#[derive(Debug, Copy, Clone)]
pub enum DocumentFormat {
OpenAi,
Anthropic,
}
/// Media types that providers accept as native document input. Anything else is
/// reported back to the caller rather than being sent as an unusable blob.
pub const SUPPORTED_DOCUMENT_MEDIA_TYPES: [&str; 1] = ["application/pdf"];
pub fn document_media_type_is_supported(mime_type: &str) -> bool {
SUPPORTED_DOCUMENT_MEDIA_TYPES.contains(&mime_type)
}
pub fn convert_document(document: &DocumentContent, format: &Docu
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key