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:
parent
d00873c357
commit
f78ce12860
26
src/lib/openapi/spec/ai-chat-message-schema.ts
Normal file
26
src/lib/openapi/spec/ai-chat-message-schema.ts
Normal 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>;
|
26
src/lib/openapi/spec/ai-chat-schema.ts
Normal file
26
src/lib/openapi/spec/ai-chat-schema.ts
Normal 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>;
|
@ -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';
|
||||
|
Loading…
Reference in New Issue
Block a user