1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

chore: add unleashAI chat schemas (#8405)

https://linear.app/unleash/issue/2-2788/add-unleash-ai-chat-openapi-schemas

Adds OpenAPI schemas for the Unleash AI chat and respective messages.
This commit is contained in:
Nuno Góis 2024-10-10 09:43:28 +01:00 committed by GitHub
parent d00873c357
commit f78ce12860
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,26 @@
import type { FromSchema } from 'json-schema-to-ts';
export const aiChatMessageSchema = {
$id: '#/components/schemas/aiChatMessageSchema',
type: 'object',
description: 'Describes an Unleash AI chat message.',
required: ['role', 'content'],
properties: {
role: {
type: 'string',
enum: ['system', 'user', 'assistant'],
description: 'The role of the message sender.',
example: 'user',
},
content: {
type: 'string',
description: 'The message content.',
example: 'What is your purpose?',
},
},
components: {
schemas: {},
},
} as const;
export type AIChatMessageSchema = FromSchema<typeof aiChatMessageSchema>;

View File

@ -0,0 +1,26 @@
import type { FromSchema } from 'json-schema-to-ts';
import { aiChatMessageSchema } from './ai-chat-message-schema';
export const aiChatSchema = {
$id: '#/components/schemas/aiChatSchema',
type: 'object',
description: 'Describes an Unleash AI chat.',
required: ['messages'],
properties: {
messages: {
type: 'array',
description:
'The messages exchanged between the user and the Unleash AI.',
items: {
$ref: '#/components/schemas/aiChatMessageSchema',
},
},
},
components: {
schemas: {
aiChatMessageSchema,
},
},
} as const;
export type AIChatSchema = FromSchema<typeof aiChatSchema>;

View File

@ -14,6 +14,8 @@ export * from './advanced-playground-environment-feature-schema';
export * from './advanced-playground-feature-schema';
export * from './advanced-playground-request-schema';
export * from './advanced-playground-response-schema';
export * from './ai-chat-message-schema';
export * from './ai-chat-schema';
export * from './api-token-schema';
export * from './api-tokens-schema';
export * from './application-environment-instances-schema';