diff --git a/src/models/meta/llama.ts b/src/models/meta/llama.ts index 6f252dc..15719a0 100644 --- a/src/models/meta/llama.ts +++ b/src/models/meta/llama.ts @@ -1,6 +1,9 @@ import { Model } from "../.."; -export default class LlamaModel extends Model { +export class TextGenerationModel extends Model< + TextGenerationInput, + TextGenerationOutput +> { /** * Creates a new input object for the model. * @param prompt The prompt text to pass to the model. @@ -8,14 +11,14 @@ export default class LlamaModel extends Model { * @remarks Optional properties may be set on the returned input object to * control the behavior of the model. */ - createInput(prompt: string): LlamaInput { - return { prompt }; + createInput(prompt: string): TextGenerationInput { + return { prompt }; } } @json -class LlamaInput { +class TextGenerationInput { /** * The prompt text to pass to the model. * May contain special tokens to control the behavior of the model. @@ -55,7 +58,7 @@ class LlamaInput { @json -class LlamaOutput { +class TextGenerationOutput { /** * The generated text. */ diff --git a/src/models/openai/chat.ts b/src/models/openai/chat.ts index 57a1605..08c2c20 100644 --- a/src/models/openai/chat.ts +++ b/src/models/openai/chat.ts @@ -2,19 +2,16 @@ import { Model } from "../.."; // Reference: https://platform.openai.com/docs/api-reference/chat -export default class ChatCompletionModel extends Model< - ChatCompletionInput, - ChatCompletionOutput -> { - createInput(messages: Message[]): ChatCompletionInput { +export class ChatModel extends Model { + createInput(messages: Message[]): ChatInput { const model = this.info.fullName; - return { model, messages }; + return { model, messages }; } } @json -class ChatCompletionInput { +class ChatInput { model!: string; messages!: Message[]; @@ -99,7 +96,7 @@ class ChatCompletionInput { @json -class ChatCompletionOutput { +class ChatOutput { id!: string; object!: string; choices!: Choice[]; diff --git a/src/models/openai/embeddings.ts b/src/models/openai/embeddings.ts index 3b3ca73..68a1a53 100644 --- a/src/models/openai/embeddings.ts +++ b/src/models/openai/embeddings.ts @@ -2,10 +2,7 @@ import { Model } from "../.."; // Reference: https://platform.openai.com/docs/api-reference/embeddings -export default class EmbeddingsModel extends Model< - EmbeddingsInput, - EmbeddingsOutput -> { +export class EmbeddingsModel extends Model { createInput(text: string): EmbeddingsInput { const model = this.info.fullName; return { model, input: text }; diff --git a/src/package-lock.json b/src/package-lock.json index 1f1a84d..deb3d6e 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -1,12 +1,12 @@ { "name": "@hypermode/models-as", - "version": "0.1.5", + "version": "0.1.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@hypermode/models-as", - "version": "0.1.5", + "version": "0.1.6", "license": "MIT", "dependencies": { "json-as": "^0.9.6" diff --git a/src/package.json b/src/package.json index d0fc135..c59c728 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "@hypermode/models-as", - "version": "0.1.5", + "version": "0.1.6", "description": "Hypermode Model Interface Library for AssemblyScript", "author": "Hypermode, Inc.", "license": "MIT",