Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/models/meta/llama.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import { Model } from "../..";

export default class LlamaModel extends Model<LlamaInput, LlamaOutput> {
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.
* @returns A new input object.
* @remarks Optional properties may be set on the returned input object to
* control the behavior of the model.
*/
createInput(prompt: string): LlamaInput {
return <LlamaInput>{ prompt };
createInput(prompt: string): TextGenerationInput {
return <TextGenerationInput>{ 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.
Expand Down Expand Up @@ -55,7 +58,7 @@ class LlamaInput {


@json
class LlamaOutput {
class TextGenerationOutput {
/**
* The generated text.
*/
Expand Down
13 changes: 5 additions & 8 deletions src/models/openai/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ChatInput, ChatOutput> {
createInput(messages: Message[]): ChatInput {
const model = this.info.fullName;
return <ChatCompletionInput>{ model, messages };
return <ChatInput>{ model, messages };
}
}


@json
class ChatCompletionInput {
class ChatInput {
model!: string;
messages!: Message[];

Expand Down Expand Up @@ -99,7 +96,7 @@ class ChatCompletionInput {


@json
class ChatCompletionOutput {
class ChatOutput {
id!: string;
object!: string;
choices!: Choice[];
Expand Down
5 changes: 1 addition & 4 deletions src/models/openai/embeddings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<EmbeddingsInput, EmbeddingsOutput> {
createInput(text: string): EmbeddingsInput {
const model = this.info.fullName;
return <EmbeddingsInput>{ model, input: text };
Expand Down
4 changes: 2 additions & 2 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down