From c17d14c2c4f17a32d4d24237cb2364ed73cadbe6 Mon Sep 17 00:00:00 2001 From: Mutugi <48474421+Mutugiii@users.noreply.github.com> Date: Fri, 20 Sep 2024 21:53:11 +0300 Subject: [PATCH] chat: smoother api context default (fixes #7571) (#7572) Co-authored-by: dogi --- chatapi/README.md | 4 +++- chatapi/src/utils/chat-helpers.utils.ts | 2 +- package.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/chatapi/README.md b/chatapi/README.md index 63154ec4f1..f0e03039d1 100644 --- a/chatapi/README.md +++ b/chatapi/README.md @@ -61,7 +61,8 @@ In the production environment these configs are set in the `planet.yml` file. "data": { "user": "admin", "content": "Hello", - "assistant": true, + "assistant": false, + "context": "", "aiProvider": { "name": "openai", "model"?: "gpt-3.5-turbo", @@ -76,6 +77,7 @@ In the production environment these configs are set in the `planet.yml` file. - **user**: string(required) -> Provide the planet/myPlanet username - **content**: string(required) -> The latest prompt for the AI to answer - **assistant**: boolean(required) -> Set to true if you want to use the assistants endpoint + - **context**: string(optional) -> The text context you would like to pre-load the AI Assistant with - **aiProvider**: Object(required) - **name**: string(required) -> Name of the API provider to choose from i.e openai, perplexity or gemini. - **model**: string(optional) -> Name of the specific provider model to use. Defaults to gpt-3.5-turbo for _openai_, llama-3-sonar-small-32k-online for _peplexity_ and gemini-pro for _google gemini_ diff --git a/chatapi/src/utils/chat-helpers.utils.ts b/chatapi/src/utils/chat-helpers.utils.ts index 0184aa967f..c4516a9508 100644 --- a/chatapi/src/utils/chat-helpers.utils.ts +++ b/chatapi/src/utils/chat-helpers.utils.ts @@ -124,7 +124,7 @@ export async function aiChatNonStream( messages: ChatMessage[], aiProvider: AIProvider, assistant: boolean, - context: any, + context: any = '', ): Promise { const provider = models[aiProvider.name]; if (!provider) { diff --git a/package.json b/package.json index 5667032264..74ed91e57b 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "planet", "license": "AGPL-3.0", - "version": "0.14.76", + "version": "0.14.77", "myplanet": { "latest": "v0.19.33", "min": "v0.18.33"