Skip to content

Commit

Permalink
#153: Changed the default OpenAI model & applied a static role to the…
Browse files Browse the repository at this point in the history
… stream deltas
  • Loading branch information
roma-glushko committed Jun 5, 2024
1 parent e203ecd commit bca8c8f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions pkg/api/http/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func LangStreamChatHandler(tel *telemetry.Telemetry, routerManager *routers.Rout
var chatRequest schemas.ChatStreamRequest

if err = c.ReadJSON(&chatRequest); err != nil {
// TODO: handle bad request schemas gracefully and return back validation errors
if websocket.IsUnexpectedCloseError(err, websocket.CloseNormalClosure, websocket.CloseGoingAway) {
tel.L().Warn("Streaming Chat connection is closed", zap.Error(err), zap.String("routerID", routerID))
}
Expand Down
1 change: 0 additions & 1 deletion pkg/providers/bedrock/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ func (c *Client) doChatRequest(ctx context.Context, payload *ChatRequest) (*sche
ModelName: c.config.ModelName,
Cached: false,
ModelResponse: schemas.ModelResponse{
Metadata: map[string]string{},
Message: schemas.ChatMessage{
Role: "assistant",
Content: modelResult.OutputText,
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/openai/chat_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (s *ChatStream) Recv() (*schemas.ChatStreamChunk, error) {
"generated_at": completionChunk.Created,
},
Message: schemas.ChatMessage{
Role: responseChunk.Delta.Role,
Role: "assistant", // doesn't present in all chunks
Content: responseChunk.Delta.Content,
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/openai/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func DefaultConfig() *Config {
return &Config{
BaseURL: "https://api.openai.com/v1",
ChatEndpoint: "/chat/completions",
ModelName: "gpt-3.5-turbo",
ModelName: "gpt-4o",
DefaultParams: &defaultParams,
}
}
Expand Down

0 comments on commit bca8c8f

Please sign in to comment.