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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## UNRELEASED

- Rename classes in OpenAI models [#11](https://github.com/hypermodeAI/models-as/pull/11)

## 2024-06-24 - Version 0.2.0

- Update OpenAI Embeddings model to support all allowed types of input [#6](https://github.com/hypermodeAI/models-as/pull/6)
Expand Down
10 changes: 5 additions & 5 deletions src/models/openai/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ import { Model } from "../..";
*
* Reference: https://platform.openai.com/docs/api-reference/chat
*/
export class ChatModel extends Model<ChatInput, ChatOutput> {
export class OpenAIChatModel extends Model<OpenAIChatInput, OpenAIChatOutput> {
/**
* Creates an input object for the OpenAI Chat API.
*
* @param messages: An array of messages to send to the chat model.
* @returns An input object that can be passed to the `invoke` method.
*/
createInput(messages: Message[]): ChatInput {
createInput(messages: Message[]): OpenAIChatInput {
const model = this.info.fullName;
return <ChatInput>{ model, messages };
return <OpenAIChatInput>{ model, messages };
}
}

/**
* The input object for the OpenAI Chat API.
*/
@json
class ChatInput {
class OpenAIChatInput {
/**
* The name of the model to use for the chat.
* Must be the exact string expected by the model provider.
Expand Down Expand Up @@ -234,7 +234,7 @@ export type ServiceTier = string;
* The output object for the OpenAI Chat API.
*/
@json
class ChatOutput {
class OpenAIChatOutput {
/**
* A unique identifier for the chat completion.
*/
Expand Down
13 changes: 8 additions & 5 deletions src/models/openai/embeddings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { Model } from "../..";
*
* Reference: https://platform.openai.com/docs/api-reference/embeddings
*/
export class EmbeddingsModel extends Model<EmbeddingsInput, EmbeddingsOutput> {
export class OpenAIEmbeddingsModel extends Model<
OpenAIEmbeddingsInput,
OpenAIEmbeddingsOutput
> {
/**
* Creates an input object for the OpenAI Embeddings API.
*
Expand All @@ -20,7 +23,7 @@ export class EmbeddingsModel extends Model<EmbeddingsInput, EmbeddingsOutput> {
* @remarks
* The input content must not exceed the maximum token limit of the model.
*/
createInput<T>(content: T): EmbeddingsInput {
createInput<T>(content: T): OpenAIEmbeddingsInput {
const model = this.info.fullName;

switch (idof<T>()) {
Expand Down Expand Up @@ -53,7 +56,7 @@ export class EmbeddingsModel extends Model<EmbeddingsInput, EmbeddingsOutput> {
* The input object for the OpenAI Embeddings API.
*/
@json
class EmbeddingsInput {
class OpenAIEmbeddingsInput {
/**
* The name of the model to use for the embeddings.
* Must be the exact string expected by the model provider.
Expand Down Expand Up @@ -97,7 +100,7 @@ class EmbeddingsInput {
* The input object for the OpenAI Embeddings API.
*/
@json
class TypedEmbeddingsInput<T> extends EmbeddingsInput {
class TypedEmbeddingsInput<T> extends OpenAIEmbeddingsInput {
/**
* The input content to vectorize.
*/
Expand All @@ -108,7 +111,7 @@ class TypedEmbeddingsInput<T> extends EmbeddingsInput {
* The output object for the OpenAI Embeddings API.
*/
@json
class EmbeddingsOutput {
class OpenAIEmbeddingsOutput {
/**
* The name of the output object type returned by the API.
* Always `"list"`.
Expand Down