From 8dc1def4b49b1e83d7c722208ef09b0030cbdd4c Mon Sep 17 00:00:00 2001 From: irfanpena Date: Tue, 11 Jun 2024 14:31:59 +0700 Subject: [PATCH 1/2] api: Update the API description --- .../infrastructure/controllers/embeddings.controller.ts | 4 ++-- .../infrastructure/dtos/chat/embeddings-response.dto.ts | 8 ++++---- .../dtos/embeddings/embeddings-request.dto.ts | 8 ++++---- cortex-js/src/main.ts | 4 ++++ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cortex-js/src/infrastructure/controllers/embeddings.controller.ts b/cortex-js/src/infrastructure/controllers/embeddings.controller.ts index 286b791a9..ae3c6a39a 100644 --- a/cortex-js/src/infrastructure/controllers/embeddings.controller.ts +++ b/cortex-js/src/infrastructure/controllers/embeddings.controller.ts @@ -10,8 +10,8 @@ export class EmbeddingsController { constructor(private readonly chatService: ChatUsecases) {} @ApiOperation({ - summary: 'Embedding vector for text', - description: 'Creates an embedding vector representing the input text..', + summary: 'Create embedding vector', + description: 'Creates an embedding vector representing the input text.', }) @HttpCode(200) @ApiResponse({ diff --git a/cortex-js/src/infrastructure/dtos/chat/embeddings-response.dto.ts b/cortex-js/src/infrastructure/dtos/chat/embeddings-response.dto.ts index f73a176a1..3d7cf65b3 100644 --- a/cortex-js/src/infrastructure/dtos/chat/embeddings-response.dto.ts +++ b/cortex-js/src/infrastructure/dtos/chat/embeddings-response.dto.ts @@ -3,25 +3,25 @@ import { UsageDto } from './usage.dto'; export class EmbeddingsResponseDto { @ApiProperty({ - description: 'Result object type.', + description: 'Type of the result object.', type: String, }) object: string; @ApiProperty({ - description: 'ID of the model used for embeddings', + description: 'Identifier of the model utilized for generating embeddings.', type: String, }) model: string; @ApiProperty({ - description: 'The embedding vector, which is a list of floats. ', + description: 'The embedding vector represented as an array of floating-point numbers. ', type: [Number], }) embedding: [number]; @ApiProperty({ - description: 'Returns prompt_tokens and total_tokens usage ', + description: 'Details of token usage, including prompt_tokens and total_tokens.', type: UsageDto, }) usage: UsageDto; diff --git a/cortex-js/src/infrastructure/dtos/embeddings/embeddings-request.dto.ts b/cortex-js/src/infrastructure/dtos/embeddings/embeddings-request.dto.ts index 0be76e23f..2fe75d961 100644 --- a/cortex-js/src/infrastructure/dtos/embeddings/embeddings-request.dto.ts +++ b/cortex-js/src/infrastructure/dtos/embeddings/embeddings-request.dto.ts @@ -3,21 +3,21 @@ import { ApiProperty } from '@nestjs/swagger'; export class CreateEmbeddingsDto { @ApiProperty({ - description: 'Embedding model', + description: 'The name of the embedding model to be used.', type: String, }) model: string; @ApiProperty({ description: - 'Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays.', + 'The text or token array(s) to be embedded. This can be a single string, an array of strings, or an array of token arrays to embed multiple inputs in one request.', type: [String], }) input: string | string[]; @ApiProperty({ description: - 'Encoding format for the embeddings. Supported formats are float and int.', + 'Specifies the format for the embeddings. Supported formats include `float` and `int`. This field is optional.', type: String, }) @Optional() @@ -25,7 +25,7 @@ export class CreateEmbeddingsDto { @ApiProperty({ description: - 'The number of dimensions the resulting output embeddings should have. Only supported in some models.', + 'Defines the number of dimensions for the output embeddings. This feature is supported by certain models only. This field is optional.', type: Number, }) @Optional() diff --git a/cortex-js/src/main.ts b/cortex-js/src/main.ts index fa7564669..75261665b 100644 --- a/cortex-js/src/main.ts +++ b/cortex-js/src/main.ts @@ -53,6 +53,10 @@ async function bootstrap() { 'Threads', 'These endpoints handle the creation, retrieval, updating, and deletion of conversation threads.', ) + .addTag( + 'Embeddings', + 'Endpoint for creating and retrieving embedding vectors from text inputs using specified models.', + ) .addServer('http://localhost:1337') .addServer('http://localhost:1337/v1') .build(); From 86162f038e66431935da24b37b3c48064a43430a Mon Sep 17 00:00:00 2001 From: irfanpena Date: Tue, 11 Jun 2024 14:39:22 +0700 Subject: [PATCH 2/2] docs: Update the dependencies --- README.md | 2 +- cortex-js/README.md | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 66a0f072b..aa2e3804c 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Cortex currently supports two inference engines: Before installation, ensure that you have installed the following: -- **Node.js**: Required for running the installation. +- **Node.js**: version 18 and above is required to run the installation. - **NPM**: Needed to manage packages. - **CPU Instruction Sets**: Available for download from the [Cortex GitHub Releases](https://github.com/janhq/cortex/releases) page. diff --git a/cortex-js/README.md b/cortex-js/README.md index 5730c98f7..6dac72720 100644 --- a/cortex-js/README.md +++ b/cortex-js/README.md @@ -32,8 +32,7 @@ Cortex ### **Dependencies** Before installation, ensure that you have installed the following: - -- **Node.js**: Required for running the installation. +- **Node.js**: version 18 and above is required to run the installation. - **NPM**: Needed to manage packages. - **CPU Instruction Sets**: Available for download from the [Cortex GitHub Releases](https://github.com/janhq/cortex/releases) page.