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

🔧 #161: Refined the chat stream req/responses #179

Merged
merged 4 commits into from
Mar 19, 2024

Conversation

roma-glushko
Copy link
Member

@roma-glushko roma-glushko commented Mar 17, 2024

Changes

  • Separated chat & chat stream request schemas
  • introduced a new finish reason field
  • added metadata to stream chat response
  • allow to attach some metadata to a chat stream request and then attach it to each chat stream chunk
  • adjusted error message schema to include request ID and metadata

… finish reason field & added metadata to stream chat response
Copy link

codecov bot commented Mar 17, 2024

Codecov Report

Attention: Patch coverage is 75.49020% with 25 lines in your changes are missing coverage. Please review.

Project coverage is 66.68%. Comparing base (3742035) to head (588b430).

Files Patch % Lines
pkg/routers/router.go 50.00% 8 Missing ⚠️
pkg/api/http/handlers.go 0.00% 5 Missing ⚠️
pkg/providers/openai/chat.go 76.92% 2 Missing and 1 partial ⚠️
pkg/providers/openai/chat_stream.go 94.00% 2 Missing and 1 partial ⚠️
pkg/providers/anthropic/chat_stream.go 0.00% 1 Missing ⚠️
pkg/providers/azureopenai/chat_stream.go 0.00% 1 Missing ⚠️
pkg/providers/bedrock/chat_stream.go 0.00% 1 Missing ⚠️
pkg/providers/cohere/chat_stream.go 0.00% 1 Missing ⚠️
pkg/providers/octoml/chat_stream.go 0.00% 1 Missing ⚠️
pkg/providers/ollama/chat_stream.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #179      +/-   ##
===========================================
+ Coverage    66.61%   66.68%   +0.07%     
===========================================
  Files           70       70              
  Lines         3082     3119      +37     
===========================================
+ Hits          2053     2080      +27     
- Misses         925      934       +9     
- Partials       104      105       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -17,7 +17,7 @@ func NewChatFromStr(message string) *ChatRequest {
Message: ChatMessage{
"human",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this needs to be "user" instead of "human"

Copy link
Contributor

Choose a reason for hiding this comment

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

Since all providers take "user" as input in request schema

Copy link
Member Author

Choose a reason for hiding this comment

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

I see yeah it makes sense to change that. However, it makes almost no effect as it's used in tests only to mock request schema. I will take care of this in a followup PR 👀

func NewChatStreamFromStr(message string) *ChatStreamRequest {
return &ChatStreamRequest{
Message: ChatMessage{
"human",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be "user" instead of human"

@roma-glushko roma-glushko merged commit dc7d42f into develop Mar 19, 2024
10 checks passed
@roma-glushko roma-glushko deleted the 161-modify-stream-schemas branch March 19, 2024 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants