Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implement Kyuubi Chat Engine #4544

Closed
wants to merge 5 commits into from
Closed

Conversation

pan3793
Copy link
Member

@pan3793 pan3793 commented Mar 16, 2023

Why are the changes needed?

Introduce a brand new CHAT engine, it's supposed to support different backends, e.g. ChatGPT, 文心一言, etc.

This PR implements the following providers:

Add the following configurations in kyuubi-defaults.conf

kyuubi.engine.chat.provider=[ECHO|GPT]
kyuubi.engine.chat.gpt.apiKey=<chat-gpt-api-key> 

Open an ECHO beeline chat engine.

beeline -u 'jdbc:hive2://localhost:10009/?kyuubi.engine.type=CHAT;kyuubi.engine.chat.provider=ECHO'
Connecting to jdbc:hive2://localhost:10009/
Connected to: Kyuubi Chat Engine (version 1.8.0-SNAPSHOT)
Driver: Kyuubi Project Hive JDBC Client (version 1.7.0)
Beeline version 1.7.0 by Apache Kyuubi
0: jdbc:hive2://localhost:10009/> Hello, Kyuubi!;
+----------------------------------------+
|                 reply                  |
+----------------------------------------+
| This is ChatKyuubi, nice to meet you!  |
+----------------------------------------+
1 row selected (0.397 seconds)

Open a ChatGPT beeline chat engine. (make sure your network can connect the open API and configure the API key)

beeline -u 'jdbc:hive2://localhost:10009/?kyuubi.engine.type=CHAT;kyuubi.engine.chat.provider=GPT'

image

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

  • Run test locally before make a pull request

@github-actions github-actions bot added the kind:documentation Documentation is a feature! label Mar 17, 2023
@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2023

Codecov Report

Merging #4544 (af38bdc) into master (b7290dc) will decrease coverage by 0.10%.
The diff coverage is 32.89%.

❗ Current head af38bdc differs from pull request most recent head 87bdebb. Consider uploading reports for the commit 87bdebb to get more accurate results

@@             Coverage Diff              @@
##             master    #4544      +/-   ##
============================================
- Coverage     53.26%   53.16%   -0.10%     
  Complexity       13       13              
============================================
  Files           572      573       +1     
  Lines         31393    31471      +78     
  Branches       4227     4234       +7     
============================================
+ Hits          16722    16733      +11     
- Misses        13092    13159      +67     
  Partials       1579     1579              
Impacted Files Coverage Δ
...ain/scala/org/apache/kyuubi/engine/EngineRef.scala 70.54% <0.00%> (-1.12%) ⬇️
...apache/kyuubi/engine/chat/ChatProcessBuilder.scala 0.00% <0.00%> (ø)
...in/scala/org/apache/kyuubi/config/KyuubiConf.scala 97.26% <88.88%> (-0.15%) ⬇️
...in/scala/org/apache/kyuubi/engine/EngineType.scala 100.00% <100.00%> (ø)

... and 8 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@pan3793
Copy link
Member Author

pan3793 commented Mar 17, 2023

Thanks @cxzl25, it works w/ ChatGPT now
image

@pan3793 pan3793 self-assigned this Mar 17, 2023
@pan3793 pan3793 added this to the v1.8.0 milestone Mar 17, 2023
@pan3793 pan3793 changed the title [WIP] Initial implement Kyuubi Chat Engine Initial implement Kyuubi Chat Engine Mar 17, 2023
Copy link
Member

@SteNicholas SteNicholas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

chatHistory.getIfPresent(sessionId)
}

// TODO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted


val ENGINE_CHAT_GPT_TOKEN: OptionalConfigEntry[String] =
buildConf("kyuubi.engine.chat.gpt.token")
.doc("The heap memory for the Chat engine")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heap memory -> token

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, updated

@yikf
Copy link
Contributor

yikf commented Mar 17, 2023

LGTM~, Nice work👍 @pan3793 @cxzl25

@pan3793
Copy link
Member Author

pan3793 commented Mar 17, 2023

Thanks all, merged to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants