From 2b8c0ec2fe8748e35db71ee1d2d6799114deeec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20D=C3=B6tsch?= Date: Wed, 8 Nov 2023 12:23:57 +0100 Subject: [PATCH] openai: add make it possible to set the "user" in the gpt completion call --- command/openai/client.go | 1 + command/openai/config.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/command/openai/client.go b/command/openai/client.go index 0fe3f2d6..94da5473 100644 --- a/command/openai/client.go +++ b/command/openai/client.go @@ -20,6 +20,7 @@ func CallChatGPT(cfg Config, inputMessages []ChatMessage, stream bool) (<-chan s Temperature: cfg.Temperature, Seed: cfg.Seed, MaxTokens: cfg.MaxTokens, + User: cfg.APILogUser, Stream: stream, Messages: inputMessages, }) diff --git a/command/openai/config.go b/command/openai/config.go index d215af52..5c3531fd 100644 --- a/command/openai/config.go +++ b/command/openai/config.go @@ -27,6 +27,9 @@ type Config struct { // log all input+output text to the logger. This could include personal information, therefore disabled by default! LogTexts bool `mapstructure:"log_texts"` + + // user name to identify the bot which should be part of the OpenAI usage statistics + APILogUser string `mapstructure:"api_log_user"` } // IsEnabled checks if token is set