diff --git a/resources/py/pyproject.toml.template b/resources/py/pyproject.toml.template index c09ea60..f65015a 100644 --- a/resources/py/pyproject.toml.template +++ b/resources/py/pyproject.toml.template @@ -1,6 +1,6 @@ [project] name = "guardrails-api-client" -version = "0.3.8" +version = "0.3.9" description = "Guardrails API Client." authors = [ {name = "Guardrails AI", email = "contact@guardrailsai.com"} diff --git a/resources/ts/package.json b/resources/ts/package.json index c8971e3..79428eb 100644 --- a/resources/ts/package.json +++ b/resources/ts/package.json @@ -1,6 +1,6 @@ { "name": "@guardrails-ai/api-client", - "version": "0.3.8", + "version": "0.3.9", "description": "Client libaray for interacting with the guardrails-api", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/service-specs/guardrails-service-spec.yml b/service-specs/guardrails-service-spec.yml index 0e562b7..370bad1 100644 --- a/service-specs/guardrails-service-spec.yml +++ b/service-specs/guardrails-service-spec.yml @@ -152,6 +152,36 @@ paths: application/json: schema: $ref: "#/components/schemas/HttpError" + /guards/{guardName}/openai/v1/chat/completions: + post: + operationId: openaiChatCompletion + tags: + - openai + summary: OpenAI SDK compatible endpoint for Chat Completions + parameters: + - $ref: "#/components/parameters/GuardName" + security: + - ApiKeyAuth: [] + - BearerAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/OpenAIChatCompletionPayload" + responses: + "200": + description: The output of the completion + content: + application/json: + schema: + $ref: "#/components/schemas/OpenAIChatCompletion" + default: + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/HttpError" /guards/{guardName}/validate: post: operationId: validate @@ -252,6 +282,59 @@ components: type: string format: password schemas: + OpenAIChatCompletionPayload: + type: object + properties: + model: + type: string + description: The model to use for the completion + example: gpt-3.5-turbo + messages: + type: array + items: + type: object + properties: + role: + type: string + description: The role of the message + content: + type: string + description: The content of the message + description: The messages to use for the completion + max_tokens: + type: integer + description: The maximum number of tokens to generate + temperature: + type: number + description: The sampling temperature + OpenAIChatCompletion: + type: object + properties: + id: + type: string + description: The id + created: + type: string + description: The created date + model_name: + type: string + description: The model name + choices: + type: array + items: + type: object + properties: + role: + type: string + description: The role of the message + content: + type: string + description: The content of the message + required: + - id + - created + - model_name + - choices HttpError: type: object properties: