Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Commit e6042a2

Browse files
Rename classes in OpenAI models (#11)
1 parent fb974bc commit e6042a2

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## UNRELEASED
4+
5+
- Rename classes in OpenAI models [#11](https://github.com/hypermodeAI/models-as/pull/11)
6+
37
## 2024-06-24 - Version 0.2.0
48

59
- Update OpenAI Embeddings model to support all allowed types of input [#6](https://github.com/hypermodeAI/models-as/pull/6)

src/models/openai/chat.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ import { Model } from "../..";
55
*
66
* Reference: https://platform.openai.com/docs/api-reference/chat
77
*/
8-
export class ChatModel extends Model<ChatInput, ChatOutput> {
8+
export class OpenAIChatModel extends Model<OpenAIChatInput, OpenAIChatOutput> {
99
/**
1010
* Creates an input object for the OpenAI Chat API.
1111
*
1212
* @param messages: An array of messages to send to the chat model.
1313
* @returns An input object that can be passed to the `invoke` method.
1414
*/
15-
createInput(messages: Message[]): ChatInput {
15+
createInput(messages: Message[]): OpenAIChatInput {
1616
const model = this.info.fullName;
17-
return <ChatInput>{ model, messages };
17+
return <OpenAIChatInput>{ model, messages };
1818
}
1919
}
2020

2121
/**
2222
* The input object for the OpenAI Chat API.
2323
*/
2424
@json
25-
class ChatInput {
25+
class OpenAIChatInput {
2626
/**
2727
* The name of the model to use for the chat.
2828
* Must be the exact string expected by the model provider.
@@ -234,7 +234,7 @@ export type ServiceTier = string;
234234
* The output object for the OpenAI Chat API.
235235
*/
236236
@json
237-
class ChatOutput {
237+
class OpenAIChatOutput {
238238
/**
239239
* A unique identifier for the chat completion.
240240
*/

src/models/openai/embeddings.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import { Model } from "../..";
55
*
66
* Reference: https://platform.openai.com/docs/api-reference/embeddings
77
*/
8-
export class EmbeddingsModel extends Model<EmbeddingsInput, EmbeddingsOutput> {
8+
export class OpenAIEmbeddingsModel extends Model<
9+
OpenAIEmbeddingsInput,
10+
OpenAIEmbeddingsOutput
11+
> {
912
/**
1013
* Creates an input object for the OpenAI Embeddings API.
1114
*
@@ -20,7 +23,7 @@ export class EmbeddingsModel extends Model<EmbeddingsInput, EmbeddingsOutput> {
2023
* @remarks
2124
* The input content must not exceed the maximum token limit of the model.
2225
*/
23-
createInput<T>(content: T): EmbeddingsInput {
26+
createInput<T>(content: T): OpenAIEmbeddingsInput {
2427
const model = this.info.fullName;
2528

2629
switch (idof<T>()) {
@@ -53,7 +56,7 @@ export class EmbeddingsModel extends Model<EmbeddingsInput, EmbeddingsOutput> {
5356
* The input object for the OpenAI Embeddings API.
5457
*/
5558
@json
56-
class EmbeddingsInput {
59+
class OpenAIEmbeddingsInput {
5760
/**
5861
* The name of the model to use for the embeddings.
5962
* Must be the exact string expected by the model provider.
@@ -97,7 +100,7 @@ class EmbeddingsInput {
97100
* The input object for the OpenAI Embeddings API.
98101
*/
99102
@json
100-
class TypedEmbeddingsInput<T> extends EmbeddingsInput {
103+
class TypedEmbeddingsInput<T> extends OpenAIEmbeddingsInput {
101104
/**
102105
* The input content to vectorize.
103106
*/
@@ -108,7 +111,7 @@ class TypedEmbeddingsInput<T> extends EmbeddingsInput {
108111
* The output object for the OpenAI Embeddings API.
109112
*/
110113
@json
111-
class EmbeddingsOutput {
114+
class OpenAIEmbeddingsOutput {
112115
/**
113116
* The name of the output object type returned by the API.
114117
* Always `"list"`.

0 commit comments

Comments
 (0)