Skip to content

Commit

Permalink
Add example
Browse files Browse the repository at this point in the history
  • Loading branch information
irfanpena committed Jun 27, 2024
1 parent fe88021 commit 0cde51e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { IsString } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class ChatCompletionMessage {
@ApiProperty({ description: 'The Content of the chat message.' })
@ApiProperty({ description: 'The Content of the chat message.', example: 'Hello World', })
@IsString()
content: string;

@ApiProperty({
description: 'The role of the entity in the chat completion.',
example: 'user',
})
role: 'user' | 'assistant';
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ export class CreateChatCompletionDto {

@ApiProperty({
description: 'The unique identifier of the model.',
example: 'gpt-4',
})
@IsString()
model: string;

@ApiProperty({
description:
'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,
})
@IsOptional()
@IsBoolean()
Expand All @@ -37,6 +39,7 @@ export class CreateChatCompletionDto {
@ApiProperty({
description:
'Sets the upper limit on the number of tokens the model can generate in a single output.',
example: 4096,
})
@IsOptional()
@IsNumber()
Expand All @@ -45,6 +48,7 @@ export class CreateChatCompletionDto {
@ApiProperty({
description:
'Defines specific tokens or phrases that signal the model to stop producing further output.',
example: ["End"],
})
@IsOptional()
@IsArray()
Expand All @@ -53,6 +57,7 @@ export class CreateChatCompletionDto {
@ApiProperty({
description:
'Modifies the likelihood of the model repeating the same words or phrases within a single output.',
example: 0.2,
})
@IsOptional()
@IsNumber()
Expand All @@ -61,20 +66,23 @@ export class CreateChatCompletionDto {
@ApiProperty({
description:
'Reduces the likelihood of repeating tokens, promoting novelty in the output.',
example: 0.6,
})
@IsOptional()
@IsNumber()
presence_penalty?: number;

@ApiProperty({
description: "Influences the randomness of the model's output.",
example: 0.8,
})
@IsOptional()
@IsNumber()
temperature?: number;

@ApiProperty({
description: 'Sets probability threshold for more relevant outputs.',
example: 0.95,
})
@IsOptional()
@IsNumber()
Expand Down
2 changes: 2 additions & 0 deletions cortex-js/src/infrastructure/dtos/chat/message.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ export class MessageDto {
@ApiProperty({
description:
'The textual content of the chat message or completion generated by the model.',
example: 'Hello World',
type: String,
})
content: string;

@ApiProperty({
description:
"The role of the participant in the chat, such as 'user' or 'system', indicating who is the sender of the message.",
example: 'user',
type: String,
})
role: string;
Expand Down

0 comments on commit 0cde51e

Please sign in to comment.