Remove message and combine types to chat. Also use correct package name.master
@@ -1,5 +1,5 @@ | |||||
{ | { | ||||
"name": "openai-utils", | |||||
"name": "@modal-sh/mio-ai", | |||||
"version": "0.0.0", | "version": "0.0.0", | ||||
"files": [ | "files": [ | ||||
"dist", | "dist", | ||||
@@ -34,7 +34,7 @@ | |||||
"test": "vitest" | "test": "vitest" | ||||
}, | }, | ||||
"private": false, | "private": false, | ||||
"description": "Custom wrapper for OpenAI API.", | |||||
"description": "Many-in-one AI client.", | |||||
"repository": { | "repository": { | ||||
"url": "https://code.modal.sh/modal-soft/openai-utils", | "url": "https://code.modal.sh/modal-soft/openai-utils", | ||||
"type": "git" | "type": "git" | ||||
@@ -1,5 +1,17 @@ | |||||
import Handlebars from 'handlebars'; | import Handlebars from 'handlebars'; | ||||
import { Message, MessageRole } from './message'; | |||||
export enum MessageRole { | |||||
SYSTEM = 'system', | |||||
USER = 'user', | |||||
ASSISTANT = 'assistant', | |||||
} | |||||
export interface MessageObject { | |||||
role: MessageRole; | |||||
content: string; | |||||
} | |||||
export type Message = string | MessageObject; | |||||
const isValidMessageObject = (maybeMessage: unknown): maybeMessage is Message => { | const isValidMessageObject = (maybeMessage: unknown): maybeMessage is Message => { | ||||
if (typeof maybeMessage !== 'object') { | if (typeof maybeMessage !== 'object') { | ||||
@@ -7,9 +7,8 @@ import { | |||||
PlatformResponse, | PlatformResponse, | ||||
UsageMetadata, | UsageMetadata, | ||||
} from '../common'; | } from '../common'; | ||||
import { Message, MessageObject } from '../message'; | |||||
import { ChatCompletionModel } from '../models'; | import { ChatCompletionModel } from '../models'; | ||||
import { normalizeChatMessage } from '../chat'; | |||||
import { normalizeChatMessage, Message, MessageObject } from '../chat'; | |||||
export interface CreateChatCompletionParams { | export interface CreateChatCompletionParams { | ||||
messages: Message | Message[]; | messages: Message | Message[]; | ||||
@@ -1,6 +1,6 @@ | |||||
import { Configuration } from './common'; | import { Configuration } from './common'; | ||||
export * from './message'; | |||||
export * from './chat'; | |||||
export * from './models'; | export * from './models'; | ||||
export * from './common'; | export * from './common'; | ||||
export { PlatformEventEmitter, PlatformEventEmitterImpl } from './events'; | export { PlatformEventEmitter, PlatformEventEmitterImpl } from './events'; | ||||
@@ -1,12 +0,0 @@ | |||||
export enum MessageRole { | |||||
SYSTEM = 'system', | |||||
USER = 'user', | |||||
ASSISTANT = 'assistant', | |||||
} | |||||
export interface MessageObject { | |||||
role: MessageRole; | |||||
content: string; | |||||
} | |||||
export type Message = string | MessageObject; |