Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 30d44a5

Browse files
authored
add better example for the request body (#883)
1 parent 8612d59 commit 30d44a5

File tree

6 files changed

+19
-16
lines changed

6 files changed

+19
-16
lines changed

cortex-js/src/infrastructure/dtos/chat/chat-completion-message.dto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export class ChatCompletionMessage {
88

99
@ApiProperty({
1010
description: 'The role of the entity in the chat completion.',
11+
example: 'user'
1112
})
1213
role: 'user' | 'assistant';
1314
}

cortex-js/src/infrastructure/dtos/chat/create-chat-completion.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class CreateChatCompletionDto {
2222

2323
@ApiProperty({
2424
description: 'The unique identifier of the model.',
25-
example: 'gpt-4',
25+
example: 'mistral',
2626
})
2727
@IsString()
2828
model: string;

cortex-js/src/infrastructure/dtos/embeddings/embeddings-request.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ApiProperty } from '@nestjs/swagger';
33

44
export class CreateEmbeddingsDto {
55
@ApiProperty({
6-
example: 'llama3',
6+
example: 'mistral',
77
description: 'The name of the embedding model to be used.',
88
type: String,
99
})

cortex-js/src/infrastructure/dtos/models/create-model.dto.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ import { ApiProperty, getSchemaPath } from '@nestjs/swagger';
1212

1313
export class CreateModelDto implements Partial<Model> {
1414
// Cortex Meta
15-
@ApiProperty({ description: 'The unique identifier of the model.' })
15+
@ApiProperty({ description: 'The unique identifier of the model.', example: 'mistral' })
1616
@IsString()
1717
model: string;
1818

19-
@ApiProperty({ description: 'The name of the model.' })
19+
@ApiProperty({ description: 'The name of the model.', example: 'mistral' })
2020
@IsString()
2121
name?: string;
2222

2323
@ApiProperty({
24-
description: 'The URL sources from which the model downloaded or accessed.',
24+
description: 'The URL sources from which the model downloaded or accessed.', example: ['https://huggingface.co/cortexso/mistral/tree/gguf'],
2525
oneOf: [
2626
{ type: 'array', items: { type: 'string' } },
2727
{ $ref: getSchemaPath(ModelArtifactDto) },
@@ -33,15 +33,16 @@ export class CreateModelDto implements Partial<Model> {
3333
// Model Input / Output Syntax
3434
@ApiProperty({
3535
description:
36-
"A predefined text or framework that guides the AI model's response generation.",
36+
"A predefined text or framework that guides the AI model's response generation.", example: `
37+
You are an expert in {subject}. Provide a detailed and thorough explanation on the topic of {topic}.`
3738
})
3839
@IsOptional()
3940
@IsString()
4041
prompt_template?: string;
4142

4243
@ApiProperty({
4344
description:
44-
'Defines specific tokens or phrases that signal the model to stop producing further output.',
45+
'Defines specific tokens or phrases that signal the model to stop producing further output.', example: ['End']
4546
})
4647
@IsOptional()
4748
@IsArray()
@@ -58,38 +59,38 @@ export class CreateModelDto implements Partial<Model> {
5859
max_tokens?: number;
5960

6061
@ApiProperty({
61-
description: 'Sets probability threshold for more relevant outputs.',
62+
description: 'Sets probability threshold for more relevant outputs.', example: 0.9
6263
})
6364
@IsOptional()
6465
@IsNumber()
6566
top_p?: number;
6667

6768
@ApiProperty({
68-
description: "Influences the randomness of the model's output.",
69+
description: "Influences the randomness of the model's output.", example: 0.7
6970
})
7071
@IsOptional()
7172
@IsNumber()
7273
temperature?: number;
7374

7475
@ApiProperty({
7576
description:
76-
'Modifies the likelihood of the model repeating the same words or phrases within a single output.',
77+
'Modifies the likelihood of the model repeating the same words or phrases within a single output.', example: 0.5
7778
})
7879
@IsOptional()
7980
@IsNumber()
8081
frequency_penalty?: number;
8182

8283
@ApiProperty({
8384
description:
84-
'Reduces the likelihood of repeating tokens, promoting novelty in the output.',
85+
'Reduces the likelihood of repeating tokens, promoting novelty in the output.', example: 0.6
8586
})
8687
@IsOptional()
8788
@IsNumber()
8889
presence_penalty?: number;
8990

9091
@ApiProperty({
9192
description:
92-
'Determines the format for output generation. If set to `true`, the output is generated continuously, allowing for real-time streaming of responses. If set to `false`, the output is delivered in a single JSON file.',
93+
'Determines the format for output generation. If set to `true`, the output is generated continuously, allowing for real-time streaming of responses. If set to `false`, the output is delivered in a single JSON file.', example: true
9394
})
9495
@IsOptional()
9596
@IsBoolean()

cortex-js/src/infrastructure/dtos/models/model.dto.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010

1111
export class ModelDto implements Partial<Model> {
1212
@ApiProperty({
13-
example: 'llama3',
13+
example: 'mistral',
1414
description:
1515
'The model identifier, which can be referenced in the API endpoints.',
1616
})
@@ -19,7 +19,7 @@ export class ModelDto implements Partial<Model> {
1919

2020
// Prompt Settings
2121
@ApiProperty({
22-
example: 'system\n{system_message}\nuser\n{prompt}\nassistant',
22+
example: `You are an expert in {subject}. Provide a detailed and thorough explanation on the topic of {topic}.`,
2323
description:
2424
"A predefined text or framework that guides the AI model's response generation.",
2525
})
@@ -28,7 +28,7 @@ export class ModelDto implements Partial<Model> {
2828

2929
@ApiProperty({
3030
type: [String],
31-
example: [],
31+
example: ["End"],
3232
description:
3333
'Defines specific tokens or phrases that signal the model to stop producing further output.',
3434
})
@@ -116,6 +116,7 @@ export class ModelDto implements Partial<Model> {
116116

117117
@ApiProperty({
118118
description: 'The prompt to use for internal configuration',
119+
example: "You are an assistant with expert knowledge in {subject}. Please provide a detailed and accurate response to the following query: {query}. Ensure that your response is clear, concise, and informative."
119120
})
120121
@IsOptional()
121122
@IsString()

cortex-js/src/infrastructure/dtos/threads/create-thread-assistant.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class CreateThreadAssistantDto implements Assistant {
3333
name: string;
3434

3535
@ApiProperty({
36-
example: 'llama3',
36+
example: 'mistral',
3737
description: 'The model\'s unique identifier and settings.',
3838
type: 'string',
3939
})

0 commit comments

Comments
 (0)