Map Inline Formatting Openai Endpoint
POST
/format/map_inline_formatting_openai
const url = 'https://example.com/format/map_inline_formatting_openai';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"source_text":"example","target_translation":"example","source_lang":"example","target_lang":"example","spans":[{"id":"example","text":"example","type":"example"}],"system_prompt":"example","model":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/format/map_inline_formatting_openai \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "source_text": "example", "target_translation": "example", "source_lang": "example", "target_lang": "example", "spans": [ { "id": "example", "text": "example", "type": "example" } ], "system_prompt": "example", "model": "example" }'Map inline formatting spans using OpenAI with a custom system prompt and model override.
Same task as /format/map_inline_formatting but accepts:
- system_prompt: custom system prompt (defaults to the standard formatting mapping prompt)
- model: OpenAI model name (defaults to “gpt-4o”)
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
CustomFormattingRequest
object
source_text
required
Source Text
Full source text
string
target_translation
required
Target Translation
Full translated text
string
source_lang
required
Source Lang
Source language code (e.g. ‘en’)
string
target_lang
required
Target Lang
Target language code (e.g. ‘de’)
string
spans
required
Spans
Formatting spans to map from source to target
Array<object>
FormattingSpanobject
id
required
Id
UUID of the source formatting span
string
text
required
Text
The formatted text in the source
string
type
required
Type
Formatting type: bold, italic, underline, etc.
string
Examplegenerated
{ "source_text": "example", "target_translation": "example", "source_lang": "example", "target_lang": "example", "spans": [ { "id": "example", "text": "example", "type": "example" } ], "system_prompt": "example", "model": "example"}Responses
Section titled “Responses”Successful Response
Media typeapplication/json
FormattingResponse
object
mappings
required
Mappings
Successfully mapped formatting spans
Array<object>
FormattingMappingobject
source_id
required
Source Id
UUID of the source span this mapping refers to
string
target_text
required
Target Text
Exact substring of the target translation to format
string
confidence
required
Confidence
Model confidence for this mapping
number
dropped_count
required
Dropped Count
Spans dropped due to failed self-check or low confidence
integer
processing_time_ms
required
Processing Time Ms
Processing time in milliseconds
number
success
required
Success
Whether the mapping call succeeded
boolean
usage
Any of:
TokenUsage
null
Examplegenerated
{ "mappings": [ { "source_id": "example", "target_text": "example", "confidence": 1 } ], "dropped_count": 1, "processing_time_ms": 1, "success": true, "error_message": "example", "usage": { "prompt_tokens": 1, "completion_tokens": 1, "total_tokens": 1, "quantization": "example", "gpu_mem_allocated_gb": 1, "gpu_mem_reserved_gb": 1 }}Validation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}