{"openapi":"3.0.3","info":{"description":"Chat Completion","title":"Chat Completion","version":"1.0"},"servers":[{"url":"{pryon_base_url}"}],"tags":[{"name":"Chat Completion"}],"paths":{"/api/generative/v1alpha1/chat/completions":{},"/api/generative/v1alpha1/chat/completions/models":{"get":{"description":"Lists the models available for our Chat Completions API","operationId":"Generative_ListChatCompletionsModels","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListChatCompletionsModelsRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListChatCompletionsModelsResponse"}}},"description":"OK"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}},"description":"Default error response"}},"tags":["Generative"],"parameters":[{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"example":"Authorization: Bearer {base64-encoded-token}"},{"name":"x-pryon-org-id","in":"header","required":false,"schema":{"type":"string"},"description":"Organization ID; only required for organizations with multiple tenants.","example":"pryoninc.com"}]}},"/api/generative/v1alpha1/tasks/complete-query":{"post":{"description":"Generates a completed query by replacing references to entities / information\n in prior turns of the conversation.","operationId":"Generative_CompleteQuery","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteQueryRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteQueryResponse"}}},"description":"OK"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}},"description":"Default error response"}},"tags":["Generative"],"parameters":[{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"example":"Authorization: Bearer {base64-encoded-token}"},{"name":"x-pryon-org-id","in":"header","required":false,"schema":{"type":"string"},"description":"Organization ID; only required for organizations with multiple tenants.","example":"pryoninc.com"}]}},"/api/generative/v1alpha1/tasks/guardrail-query":{"post":{"description":"Return query toxicity and prompt injection classifications given a query","operationId":"Generative_GuardrailQuery","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryGuardrailsRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryGuardrailsResponse"}}},"description":"OK"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}},"description":"Default error response"}},"tags":["Generative"],"parameters":[{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"example":"Authorization: Bearer {base64-encoded-token}"},{"name":"x-pryon-org-id","in":"header","required":false,"schema":{"type":"string"},"description":"Organization ID; only required for organizations with multiple tenants.","example":"pryoninc.com"}]}},"/api/generative/v1alpha1/tasks/route-query":{"post":{"description":"Return query out-of-domain classifications given a query","operationId":"Generative_RouteQuery","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RouteQueryRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RouteQueryResponse"}}},"description":"OK"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}},"description":"Default error response"}},"tags":["Generative"],"parameters":[{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"example":"Authorization: Bearer {base64-encoded-token}"},{"name":"x-pryon-org-id","in":"header","required":false,"schema":{"type":"string"},"description":"Organization ID; only required for organizations with multiple tenants.","example":"pryoninc.com"}]}}},"components":{"schemas":{"ChatCompletionsModel":{"description":"An individual Chat Completions model","properties":{"id":{"description":"The id of the model. Either in the form of \"provider/model\" or \"provider/subprovider/model\"","type":"string"},"display_name":{"description":"The human friendly name of the model, used during selection in our UI","type":"string"}},"type":"object"},"ChatCompletionsModels":{"description":"A list of our Chat Completions models","properties":{"models":{"description":"List of all the available models for our Chat Completions API","items":{"$ref":"#/components/schemas/ChatCompletionsModel"},"type":"array"}},"type":"object"},"ChatCompletionsRequest":{"properties":{"messages":{"description":"List of messages that form the conversation.","type":"array","items":{"$ref":"#/components/schemas/Message"}},"model":{"description":"ID of the model to use, in provider/model_id format; for a list of valid entries, see the [available models](https://docs.pryon.com/reference/available-models-for-chat-completions#/).","type":"string"},"temperature":{"type":"number","format":"float","description":"Sampling temperature; the range depends on the product and model being called; higher values, for example, 0.8, make the output more random, while lower values, for example, 0.2, make the output more focused and deterministic; it is recommended that you adjust this value or top_p, but not both."},"top_p":{"type":"number","format":"float","description":"Alternative to sampling with temperature, that is, nucleus sampling; the model considers the results of the tokens with top_p probability mass, for example, 0.1 means tokens comprising the top 10% probability mass are considered."},"stream":{"type":"boolean","description":"If set to True, the model response data is generated using server-sent events and streamed to the client."},"stop":{"type":"array","items":{"type":"string"},"description":"Stop sequence signals for the API generation."},"max_completion_tokens":{"type":"integer","format":"int32","description":"Maximum number of tokens generated in the chat completion; can be used to control costs for text generated via API."},"logprobs":{"type":"boolean","description":"True returns the log probabilities of each output token present in the content of message; False does not return probabilities."},"top_logprobs":{"description":"An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.\n logprobs must be set to true if this parameter is used.","format":"int32","type":"integer"},"tools":{"description":"List of tools (functions) available to the model.","items":{"$ref":"#/components/schemas/Tool"},"type":"array"},"tool_choice":{"allOf":[{"$ref":"#/components/schemas/GoogleProtobufValue"}],"description":"Specifies the tool called by the model when generating a response; the simple string options below dictate the LLM behavior; defaults to none if no tools are present.\n none: the model will not call any tool and instead generates a message.\n auto: the model picks between generating a message or calling one or more tools.\n required: the model must call one or more tools.\n To force the model to call a specific tool, see Calling Specific Tools."}},"type":"object"},"ChatCompletionsResponse":{"description":"Response for chat completion\n non-streaming: https://platform.openai.com/docs/api-reference/chat/object\n streaming: https://platform.openai.com/docs/api-reference/chat/streaming","properties":{"id":{"description":"Unique identifier for the chat completion.","type":"string"},"choices":{"description":"List chat completion choices.","items":{"$ref":"#/components/schemas/Choice"},"type":"array"},"created":{"description":"Creation timestamp (in seconds) for the chat completion.","type":"string"},"model":{"description":"Model used for chat completion.","type":"string"},"object":{"description":"Object type; choices are chat.completion or chat.completion.chunk.","type":"string"},"usage":{"allOf":[{"$ref":"#/components/schemas/Usage"}],"description":"Usage statistics for the completion"}},"type":"object"},"Choice":{"description":"Individual completion choice","properties":{"index":{"description":"Index of the choice.","format":"int32","type":"integer"},"message":{"allOf":[{"$ref":"#/components/schemas/Message"}],"description":"The message containing the completion.\n Present only if stream=false in request."},"delta":{"allOf":[{"$ref":"#/components/schemas/Delta"}],"description":""},"logprobs":{"description":"Log probability information for the choice.","items":{"$ref":"#/components/schemas/LogProbs"},"type":"array"},"finish_reason":{"description":"Detailed explanation of the completion process.","type":"string"}},"type":"object"},"CompleteQueryRequest":{"properties":{"query":{"description":"Query to complete given context.","type":"string"},"conversation_context":{"description":"Context for prior turns in the conversation.","type":"string"},"conversation_id":{"description":"Retrieve context history (question-answer pairs)\n from previous exchanges in the conversation.","type":"string"}},"type":"object"},"CompleteQueryResponse":{"properties":{"completed_query":{"type":"string"}},"type":"object"},"Delta":{"description":"","properties":{"role":{"description":"Role of the message sender, that is, system, user, or assistant.","type":"string"},"content":{"description":"Content that has changes in the message.","type":"string"},"tool_calls":{"description":"For assistant messages: tool calls made by the model.","items":{"$ref":"#/components/schemas/DeltaToolCall"},"type":"array"}},"type":"object"},"DeltaToolCall":{"description":"Tool call in assistant messages (for streamed responses)","properties":{"index":{"description":"Value that defines the tool call.","format":"uint32","type":"integer"},"id":{"description":"Unique identifier for this tool call.","type":"string"},"type":{"description":"Function is the only value.","type":"string"},"function":{"allOf":[{"$ref":"#/components/schemas/FunctionCall"}],"description":"The function or tool to use."}},"type":"object"},"FunctionCall":{"description":"Function call details.","properties":{"name":{"description":"Name of the function being called.","type":"string"},"arguments":{"description":"JSON string of arguments.","type":"string"}},"type":"object"},"FunctionDefinition":{"description":"Function definition; matches the OpenAI function definition.","properties":{"name":{"description":"The called function; valid characters are a-z, A-Z, 0-9, underscores, and dashes; maximum is 64 characters.","type":"string"},"description":{"description":"The purpose for the function; how the function works.","type":"string"},"parameters":{"description":"JSON Schema as a string (since protobuf doesn't have native JSON Schema support)\n This corresponds to FunctionParameters: Dict[str, object].","type":"object"},"strict":{"description":"Whether to enable strict schema adherence.","type":"boolean"}},"type":"object"},"GoogleProtobufAny":{"additionalProperties":true,"description":"Contains an arbitrary serialized message along with a @type that describes the type of the serialized message.","properties":{"@type":{"description":"The type of the serialized message.","type":"string"}},"type":"object"},"GoogleProtobufValue":{"description":"Tool used by the model to call the functions; valid values are auto (default; model decides whether to call a function and which one to use), none (model will not call any function) and required (forces the model to call at least one of the provided functions)."},"ListChatCompletionsModelsRequest":{"description":"The request schema for our ListChatCompletionsModels endpoint.","properties":{"function_calling":{"description":"Filters for models that support function calling.","type":"boolean"}},"type":"object"},"ListChatCompletionsModelsResponse":{"description":"Response for ListChatCompletionsModels\n Provides all the available models for our Chat Completions API","properties":{"items":{"additionalProperties":{"$ref":"#/components/schemas/ChatCompletionsModels"},"description":"List of all the available models for our Chat Completions API separated by provider","type":"object"}},"type":"object"},"LogProbToken":{"properties":{"token":{"description":"The token returned.","type":"string"},"logprob":{"description":"Log probability for the token; displays position if within the top 20 most likely tokens or -9999.0 to signify an unlikely token.","format":"float","type":"number"},"bytes":{"description":"The UTF-8 bytes representation of the token; null if there is no byte representation; deliniates between multiple tokens when byte representations are combined to generate text representation.","items":{"format":"int32","type":"integer"},"type":"array"}},"type":"object"},"LogProbTokenWithTop":{"properties":{"token":{"description":"The token returned.","type":"string"},"logprob":{"description":"Log probability for the token; displays position if within the top 20 most likely tokens or -9999.0 to signify an unlikely token.","format":"float","type":"number"},"bytes":{"description":"The UTF-8 bytes representation of the token; null if there is no byte representation; deliniates between multiple tokens when byte representations are combined to generate text representation.","items":{"format":"int32","type":"integer"},"type":"array"},"top_logprobs":{"description":"List of the most likely tokens and their log probability for the token position; may be fewer than the number of requested top_logprobs returned.","items":{"$ref":"#/components/schemas/LogProbToken"},"type":"array"}},"type":"object"},"LogProbs":{"properties":{"content":{"description":"A list of message content tokens with log probability information.","items":{"$ref":"#/components/schemas/LogProbTokenWithTop"},"type":"array"},"refusal":{"description":"A list of message refusal tokens with log probability information.","items":{"$ref":"#/components/schemas/LogProbTokenWithTop"},"type":"array"}},"type":"object"},"Message":{"description":"","properties":{"role":{"description":"Role of the message sender, that is, system, user, or assistant.","type":"string"},"content":{"description":"Content that has changes in the message.","type":"string"},"tool_calls":{"description":"For assistant messages; tool calls made by the model.","items":{"$ref":"#/components/schemas/ToolCall"},"type":"array"},"name":{"description":"Optional; name for the participant; provides the model information to differentiate between participants of the same role.","type":"string"}},"type":"object","title":"Individual message in the conversation"},"QueryGuardrailsRequest":{"properties":{"query":{"description":"Query to check against guardrails models","type":"string"}},"type":"object"},"QueryGuardrailsResponse":{"properties":{"is_toxic":{"description":"Whether or not the given query contains toxic content","type":"boolean"},"is_prompt_injection_attack":{"description":"Whether or not the given query contains a prompt injection attack","type":"boolean"}},"type":"object"},"RouteQueryRequest":{"properties":{"query":{"description":"Required: Query string","type":"string"},"domain":{"description":"Modification to query classification prompt. Defaults to \"the company you provide support for\",\n but can be modified to define any domain, e.g. \"a medical device manufacturer\", \"municipal public resources\", etc.","type":"string"},"enable_generative_conversational_response":{"description":"Whether or not conversational responses are generated or canned","type":"boolean"}},"type":"object"},"RouteQueryResponse":{"properties":{"is_intelligible":{"description":"Whether or not the given query is intelligible","type":"boolean"},"is_english":{"description":"Whether or not the given query is in a supported language","type":"boolean"},"is_conversational":{"description":"Whether or not the given query is conversational","type":"boolean"},"conversational_response":{"description":"The LLM-generated response if the query is indeed conversational","type":"string"}},"type":"object"},"Status":{"description":"The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).","properties":{"code":{"description":"The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].","format":"int32","type":"integer"},"message":{"description":"A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.","type":"string"},"details":{"description":"A list of messages that carry the error details. There is a common set of message types for APIs to use.","items":{"$ref":"#/components/schemas/GoogleProtobufAny"},"type":"array"}},"type":"object"},"Tool":{"description":"Tool definition for function calling","properties":{"type":{"description":"Type of tool; function is the only tool supported.","type":"string"},"function":{"allOf":[{"$ref":"#/components/schemas/FunctionDefinition"}],"description":"Function definition"}},"type":"object"},"ToolCall":{"description":"Tool call in assistant messages (for responses).","properties":{"id":{"description":"Unique identifier for the tool call.","type":"string"},"type":{"description":"Function type.","type":"string"},"function":{"allOf":[{"$ref":"#/components/schemas/FunctionCall"}],"description":"The function/tool to use."}},"type":"object"},"Usage":{"description":"","properties":{"prompt_tokens":{"description":"Tokens in the prompt.","format":"int32","type":"integer"},"completion_tokens":{"description":"Tokens in the completion.","format":"int32","type":"integer"},"total_tokens":{"description":"Total tokens used.","format":"int32","type":"integer"}},"type":"object"}}}}