feat: pluggable image-to-text service with OpenAI vision backend (#1038)

Adds a full-stack image description service: schema, base class,                                                                  
OpenAI backend, gateway dispatch, client APIs (sync/async REST +
websocket), tg-describe-image CLI, IAM capability, and specs.                                                                     
                                                                                                                                    
Closes #879
This commit is contained in:
Sunny Yang 2026-07-12 05:47:04 -06:00 committed by GitHub
parent 9136526863
commit 40f01c123b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 1845 additions and 14 deletions

View file

@ -13,6 +13,7 @@ from unittest.mock import MagicMock
from trustgraph.schema import (
TextCompletionRequest, TextCompletionResponse,
ImageToTextRequest, ImageToTextResponse,
DocumentRagQuery, DocumentRagResponse,
AgentRequest, AgentResponse, AgentStep,
Chunk, Triple, Triples, Term, Error,
@ -29,7 +30,11 @@ def schema_registry():
# Text Completion
"TextCompletionRequest": TextCompletionRequest,
"TextCompletionResponse": TextCompletionResponse,
# Image to Text
"ImageToTextRequest": ImageToTextRequest,
"ImageToTextResponse": ImageToTextResponse,
# Document RAG
"DocumentRagQuery": DocumentRagQuery,
"DocumentRagResponse": DocumentRagResponse,
@ -70,6 +75,20 @@ def sample_message_data():
"out_token": 100,
"model": "gpt-3.5-turbo"
},
"ImageToTextRequest": {
# The image field carries base64 ASCII text end-to-end
"image": "aW1hZ2UtYnl0ZXM=",
"mime_type": "image/png",
"prompt": "Describe this image",
"system": "You are a helpful assistant."
},
"ImageToTextResponse": {
"error": None,
"description": "A single blue pixel on a white background.",
"in_token": 245,
"out_token": 32,
"model": "gpt-5-mini"
},
"DocumentRagQuery": {
"query": "What is artificial intelligence?",
"collection": "test_collection",