diff --git a/README.md b/README.md index c45cd29..4394027 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Types and utility functions to easily generate OpenAI GPT prompts for chatting w ```typescript import { Configuration, OpenAIApi } from "openai"; -import { AIPersona, ModelConfiguration, PromptService } from "@wisegpt/gpt-conversation-prompt"; +import { AIPersona, ModelConfiguration, ConversationPromptService } from "@wisegpt/gpt-conversation-prompt"; const aiPersona: AIPersona = { name: "wiseGPT", @@ -21,10 +21,10 @@ const modelConfiguration: ModelConfiguration = { }; const openAIApi = new OpenAIApi(new Configuration({ apiKey: "<>" })); -const promptService = new PromptService(openAIApi); +const conversationPromptService = new ConversationPromptService(openAIApi); async function exampleUsage() { - const { text, usage } = await promptService.conversationCompletion({ + const { text, usage } = await conversationPromptService.conversationCompletion({ prompt: { conversation: { messages: [ diff --git a/package-lock.json b/package-lock.json index 2b707c3..8a45633 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1620,9 +1620,9 @@ "dev": true }, "node_modules/@types/yargs": { - "version": "17.0.17", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.17.tgz", - "integrity": "sha512-72bWxFKTK6uwWJAVT+3rF6Jo6RTojiJ27FQo8Rf60AL+VZbzoVPnMFhKsUnbjR8A3BTCYQ7Mv3hnl8T0A+CX9g==", + "version": "17.0.18", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.18.tgz", + "integrity": "sha512-eIJR1UER6ur3EpKM3d+2Pgd+ET+k6Kn9B4ZItX0oPjjVI5PrfaRjKyLT5UYendDpLuoiJMNJvovLQbEXqhsPaw==", "dev": true, "dependencies": { "@types/yargs-parser": "*" @@ -12610,9 +12610,9 @@ "dev": true }, "@types/yargs": { - "version": "17.0.17", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.17.tgz", - "integrity": "sha512-72bWxFKTK6uwWJAVT+3rF6Jo6RTojiJ27FQo8Rf60AL+VZbzoVPnMFhKsUnbjR8A3BTCYQ7Mv3hnl8T0A+CX9g==", + "version": "17.0.18", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.18.tgz", + "integrity": "sha512-eIJR1UER6ur3EpKM3d+2Pgd+ET+k6Kn9B4ZItX0oPjjVI5PrfaRjKyLT5UYendDpLuoiJMNJvovLQbEXqhsPaw==", "dev": true, "requires": { "@types/yargs-parser": "*" diff --git a/src/prompt-service/prompt.service.ts b/src/conversation-prompt/conversation-prompt.service.ts similarity index 96% rename from src/prompt-service/prompt.service.ts rename to src/conversation-prompt/conversation-prompt.service.ts index 4981181..ede2cf5 100644 --- a/src/prompt-service/prompt.service.ts +++ b/src/conversation-prompt/conversation-prompt.service.ts @@ -6,7 +6,7 @@ import { ConversationCompleteOutput, } from "./prompt.dto"; -export class PromptService { +export class ConversationPromptService { constructor(private readonly openAIApi: OpenAIApi) {} async conversationCompletion( diff --git a/src/prompt-service/create-conversation-completion-prompt.ts b/src/conversation-prompt/create-conversation-completion-prompt.ts similarity index 100% rename from src/prompt-service/create-conversation-completion-prompt.ts rename to src/conversation-prompt/create-conversation-completion-prompt.ts diff --git a/src/conversation-prompt/index.ts b/src/conversation-prompt/index.ts new file mode 100644 index 0000000..debe39b --- /dev/null +++ b/src/conversation-prompt/index.ts @@ -0,0 +1,2 @@ +export * from "./prompt.dto"; +export { ConversationPromptService } from "./conversation-prompt.service"; diff --git a/src/prompt-service/prompt.constants.ts b/src/conversation-prompt/prompt.constants.ts similarity index 100% rename from src/prompt-service/prompt.constants.ts rename to src/conversation-prompt/prompt.constants.ts diff --git a/src/prompt-service/prompt.dto.ts b/src/conversation-prompt/prompt.dto.ts similarity index 100% rename from src/prompt-service/prompt.dto.ts rename to src/conversation-prompt/prompt.dto.ts diff --git a/src/index.ts b/src/index.ts index d73d287..9b416f7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,2 +1,2 @@ export * from "./types"; -export * from "./prompt-service"; +export * from "./conversation-prompt"; diff --git a/src/prompt-service/index.ts b/src/prompt-service/index.ts deleted file mode 100644 index 68342d6..0000000 --- a/src/prompt-service/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./prompt.dto"; -export { PromptService } from "./prompt.service"; diff --git a/test/prompt-service/create-conversation-completion-prompt.test.ts b/test/conversation-prompt/create-conversation-completion-prompt.test.ts similarity index 97% rename from test/prompt-service/create-conversation-completion-prompt.test.ts rename to test/conversation-prompt/create-conversation-completion-prompt.test.ts index 3bd2f32..39bf5db 100644 --- a/test/prompt-service/create-conversation-completion-prompt.test.ts +++ b/test/conversation-prompt/create-conversation-completion-prompt.test.ts @@ -1,5 +1,5 @@ import { AIPersona } from "../../src"; -import { createConversationCompletionPrompt } from "../../src/prompt-service/create-conversation-completion-prompt"; +import { createConversationCompletionPrompt } from "../../src/conversation-prompt/create-conversation-completion-prompt"; describe("createConversationCompletionPrompt", () => { it("should work with example conversations", () => {