Create chat completion
Changed onThis handler performs several key operations:
- Forwards the chat completion request to the inference service
- Signs the response using the node's keystore
- Tracks token usage for the stack
Arguments
- Extension((stack_small_id, estimated_total_tokens)) - Stack ID and estimated tokens count from middleware
- state - Application state containing the inference client and keystore
- payload - The chat completion request body
Returns
Returns a JSON response containing:
- The inference service's response
- A cryptographic signature of the response
Errors
Returns a AtomaServiceError::InternalError if:
- The inference service request fails
- Response parsing fails
- Response signing fails
- Token usage update fails
Request
- Base URLhttp://localhost:8080
- Authnone declared
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
Example request
{
"max_completion_tokens": 4096,
"max_tokens": 4096,
"model": "meta-llama/Llama-3.3-70B-Instruct",
"n": 1,
"seed": 123,
"temperature": 0.7,
"top_logprobs": 1,
"top_p": 1,
"user": "user-1234"
}Response
Chat completion successful
Changes
- breaking
removed
subschema #1from therequest propertyoneOflist - breaking
removed
subschema #1subschema #2subschema #3subschema #4from the/request propertyoneOflist - breaking
added 'propertyNames' constraint to the request property
/// - breaking
the
/request property type changed fromstringtointeger, and format from no format toint32 - breaking
the
request property format changed from no format toint32 - breaking
the
request property type changed from no type toarraynull - breaking
the
///request property type changed from no type toobjectnull - breaking
the response property
//became nullable for the status - breaking
the response property
became nullable for the status - breaking
the response property
//became optional for the status - breaking
the response property
became optional for the status - breaking
the response property
became optional for the status - breaking
added
subschema #1to the//response propertyoneOflist for the response status - breaking
added
subschema #1to theresponse propertyoneOflist for the response status - breaking
added
subschema #1subschema #2subschema #3subschema #4to the//response propertyoneOflist for the response status - breaking
the
response's property type changed fromobjectto no type for status - breaking
removed the required property
/from the response with the status - breaking
removed the required property
/from the response with the status - warning
the
/request property's min was set to0.00 - warning
removed the request property
- warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - info
added the new optional request property
- info
added the new optional request property
- info
added the new optional request property
- info
added the new optional request property
- info
added the new optional request property
- info
added the new optional request property
- info
added the new optional request property
- info
the request property
became nullable - info
the request property
///became nullable - info
the
request property default value[]was added - info
added
subschema #1subschema #2subschema #3subschema #4to the/request propertyoneOflist - info
added the optional property
to the response with the status - info
removed the
content_filterenum value from the//response property for the response status - info
removed the
length_cappedenum value from the//response property for the response status - info
removed the
stoppedenum value from the//response property for the response status - info
removed
subschema #1subschema #2subschema #3subschema #4from the//response propertyoneOflist for the response status
- breaking
- info
added the new optional request property
- info
request property
deprecated
- info