You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by bo...@apache.org on 2023/03/19 14:28:11 UTC
[kyuubi] branch master updated: [KYUUBI #4558] [CHAT] Make ChatGPT model ID configurable
This is an automated email from the ASF dual-hosted git repository.
bowenliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new 301a05af5 [KYUUBI #4558] [CHAT] Make ChatGPT model ID configurable
301a05af5 is described below
commit 301a05af5918cbd0eb90c9ddd1a9390b9d93dbe6
Author: liangbowen <li...@gf.com.cn>
AuthorDate: Sun Mar 19 22:27:58 2023 +0800
[KYUUBI #4558] [CHAT] Make ChatGPT model ID configurable
### _Why are the changes needed?_
- Make ChatGPT model ID configurable
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [x] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #4558 from bowenliang123/chatgpt-model.
Closes #4558
63f8ee30d [liangbowen] nit
3012ccaaa [liangbowen] make chatgpt model configurable
Authored-by: liangbowen <li...@gf.com.cn>
Signed-off-by: liangbowen <li...@gf.com.cn>
---
docs/deployment/settings.md | 1 +
.../org/apache/kyuubi/engine/chat/provider/ChatGPTProvider.scala | 2 +-
.../src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala | 8 ++++++++
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/docs/deployment/settings.md b/docs/deployment/settings.md
index db6e3d246..30f557704 100644
--- a/docs/deployment/settings.md
+++ b/docs/deployment/settings.md
@@ -125,6 +125,7 @@ You can configure the Kyuubi properties in `$KYUUBI_HOME/conf/kyuubi-defaults.co
| kyuubi.engine.chat.gpt.http.connect.timeout | PT2M | The timeout[ms] for establishing the connection with the Chat GPT server. A timeout value of zero is interpreted as an infinite timeout. [...]
| kyuubi.engine.chat.gpt.http.proxy | <undefined> | HTTP proxy url for API calling in Chat GPT engine. e.g. http://127.0.0.1:1087 [...]
| kyuubi.engine.chat.gpt.http.socket.timeout | PT2M | The timeout[ms] for waiting for data packets after Chat GPT server connection is established. A timeout value of zero is interpreted as an infinite timeout. [...]
+| kyuubi.engine.chat.gpt.model | gpt-3.5-turbo | ID of the model used in ChatGPT. Available models refer to OpenAI's [Model overview](https://platform.openai.com/docs/models/overview). [...]
| kyuubi.engine.chat.java.options | <undefined> | The extra Java options for the Chat engine [...]
| kyuubi.engine.chat.memory | 1g | The heap memory for the Chat engine [...]
| kyuubi.engine.chat.provider | ECHO | The provider for the Chat engine. Candidates: <ul> <li>ECHO: simply replies a welcome message.</li> <li>GPT: a.k.a ChatGPT, powered by OpenAI.</li></ul> [...]
diff --git a/externals/kyuubi-chat-engine/src/main/scala/org/apache/kyuubi/engine/chat/provider/ChatGPTProvider.scala b/externals/kyuubi-chat-engine/src/main/scala/org/apache/kyuubi/engine/chat/provider/ChatGPTProvider.scala
index 2e4bf3f8d..cdea89d2a 100644
--- a/externals/kyuubi-chat-engine/src/main/scala/org/apache/kyuubi/engine/chat/provider/ChatGPTProvider.scala
+++ b/externals/kyuubi-chat-engine/src/main/scala/org/apache/kyuubi/engine/chat/provider/ChatGPTProvider.scala
@@ -77,8 +77,8 @@ class ChatGPTProvider(conf: KyuubiConf) extends ChatProvider {
try {
messages.addLast(new ChatMessage("user", q))
val completionRequest = ChatCompletionRequest.builder()
+ .model(conf.get(KyuubiConf.ENGINE_CHAT_GPT_MODEL))
.messages(messages.asScala.toList.asJava)
- .model("gpt-3.5-turbo")
.build()
val responseText = openAiService.createChatCompletion(completionRequest).getChoices.asScala
.map(c => c.getMessage.getContent).mkString
diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
index 35626eea5..359ee1ba5 100644
--- a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
+++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
@@ -2659,6 +2659,14 @@ object KyuubiConf {
.stringConf
.createOptional
+ val ENGINE_CHAT_GPT_MODEL: ConfigEntry[String] =
+ buildConf("kyuubi.engine.chat.gpt.model")
+ .doc("ID of the model used in ChatGPT. Available models refer to OpenAI's " +
+ "[Model overview](https://platform.openai.com/docs/models/overview).")
+ .version("1.8.0")
+ .stringConf
+ .createWithDefault("gpt-3.5-turbo")
+
val ENGINE_CHAT_EXTRA_CLASSPATH: OptionalConfigEntry[String] =
buildConf("kyuubi.engine.chat.extra.classpath")
.doc("The extra classpath for the Chat engine, for configuring the location " +