Skip to content

Commit

Permalink
Fix/chat system prompt (#97)
Browse files Browse the repository at this point in the history
* fix type systemPromptId from UUID to string

* up version
  • Loading branch information
kevin-btc authored Nov 3, 2023
1 parent 2f0bc9f commit 0f42e9c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
7 changes: 3 additions & 4 deletions lib/chats/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import axios, { AxiosError } from "axios";
import * as t from "polyfact-io-ts";
import { UUID } from "crypto";

import {
generate,
Expand All @@ -24,7 +23,7 @@ const Message = t.type({

export async function createChat(
systemPrompt?: string,
systemPromptId?: UUID,
systemPromptId?: string,
options: InputClientOptions = {},
): Promise<string> {
try {
Expand Down Expand Up @@ -180,13 +179,13 @@ export class Chat {
}

export type ChatClient = {
createChat: (systemPrompt?: string, systemPromptId?: UUID) => Promise<string>;
createChat: (systemPrompt?: string, systemPromptId?: string) => Promise<string>;
Chat: typeof Chat;
};

export default function client(clientOptions: InputClientOptions = {}): ChatClient {
return {
createChat: (systemPrompt?: string, systemPromptId?: UUID) =>
createChat: (systemPrompt?: string, systemPromptId?: string) =>
createChat(systemPrompt, systemPromptId, clientOptions),
Chat: class C extends Chat {
constructor(options: ChatOptions = {}) {
Expand Down
3 changes: 1 addition & 2 deletions lib/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as t from "polyfact-io-ts";
import fakeProcess from "process";
import { Readable } from "readable-stream";
import WebSocket from "isomorphic-ws";
import { UUID } from "crypto";
import { InputClientOptions, defaultOptions } from "./clientOpts";
import { Memory } from "./memory";
import { loaderToMemory, LoaderFunction } from "./dataloader";
Expand Down Expand Up @@ -76,7 +75,7 @@ export type MemoryOptions = [
{ data: [LoaderFunction] | LoaderFunction },
];

export type SystemPromptOptions = [{ systemPromptId: UUID }, { systemPrompt: string }];
export type SystemPromptOptions = [{ systemPromptId: string }, { systemPrompt: string }];

export type GenerationWithWebOptions = GenerationSimpleOptions &
NeverN<ChatOptions> &
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "polyfire-js",
"version": "0.2.10",
"version": "0.2.11",
"main": "index.js",
"types": "index.d.ts",
"author": "Lancelot Owczarczak <lancelot@owczarczak.fr>",
Expand Down

0 comments on commit 0f42e9c

Please sign in to comment.