Overview
The Adaptive REST API provides endpoints for inference, feedback, and interactions. Base URL:https://your-adaptive-instance/api/v1
Completions
POST /api/v1/chat/completions
Generate chat completion
Generate a chat completion from a prompt using one model in your use case.
Your prompt messages can include several roles.
This endpoints supports streaming
Request Body
parameters
- stop (
string[] | null): - max_tokens (
integer<int32> | null): - temperature (
number<float> | null): - top_p (
number<float> | null): - serialized_python (
string | null): - messages (
ChatMessage[]) (required): - model (
string) (required): can be of the form{use_case}/{model}or{use_case}. In the latter it will use the default model - stream (
boolean): - stream_options (
any | null): - session_id (
string<uuid> | null): - user (
string<uuid> | null): - ab_campaign (
any | null): - n (
integer<int32>): - labels (
any | null): - metadata (
any | null): - system_prompt_args (
object | null): Will be used to render system prompt template - tags (
string[] | null):
ChatResponse)
a stream will be returned if streaming = true in the request
POST /api/v1/completions
Generate completion
Generate a completion from a prompt using one model in your use case.
This endpoints supports streaming
Request Body
parameters
- stop (
string[] | null): - max_tokens (
integer<int32> | null): - temperature (
number<float> | null): - top_p (
number<float> | null): - serialized_python (
string | null): - prompt (
string) (required): - model (
string) (required): can be of the form{use_case}/{model}or{use_case}. In the latter it will use the default model - stream (
boolean): - session_id (
string<uuid> | null): - user (
string<uuid> | null): - ab_campaign (
any | null): - n (
integer<int32>): - metadata (
any | null): - labels (
any | null): - tags (
string[] | null):
GenerateResponse)
a stream will be returned if streaming = true in the request
Embeddings
POST /api/v1/embeddings
Generate embeddings
Request Body
parameters
- input (
string) (required): - model (
string) (required): can be of the form ’/’ or ''. In the latter it will use the default model - encoding_format (
any | null): - dimensions (
integer<int32> | null): - user (
string<uuid> | null):
EmbeddingsResponseList)
Feedback
POST /api/v1/feedback
Add feedback
Register a feedback about a previous interaction (chat or generation)
Request Body
parameters
- value (
any) (required): If the metric is Bool, accepts0,1,trueorfalseIf the metric is Scalar, accepts number - completion_id (
string<uuid>) (required): - metric (
IdOrKey) (required): - user_id (
string<uuid> | null): - reason (
any | null): - details (
string | null):
FeedbackOutput)
feedback recorded
POST /api/v1/comparison
Add preference
Register preference between two interactions according to a criteria.
Both interactions should share the same prompt.
Request Body
parameters
- metric (
IdOrKey) (required): - prompt (
string | null): Required (or messages) when using raw text for completion, ignored if using ids - messages (
ChatMessage[] | null): Required (or prompt) when using raw text for completion, ignored if using ids - preferred_completion (
CompletionIdOrText) (required): - other_completion (
CompletionIdOrText) (required): - tied (
any | null): - use_case (
any | null): - user_id (
string<uuid>) (required):
ComparisonOutput)
Comparison recorded
Interactions
POST /api/v1/interactions
Add interaction
Import an interaction in your use case. You can also include feedback about the interaction
Request Body
parameters
- model_service (
IdOrKey) (required): - use_case (
IdOrKey) (required): - prompt (
string | null): - messages (
ChatMessage[] | null): - completion (
string) (required): - feedbacks (
InteractionFeedback[]): - user (
string<uuid> | null): - session_id (
string<uuid> | null): - created_at (
any | null): - ab_campaign (
any | null): - labels (
any | null):
AddInteractionsResponse)
Interaction recorded
