Skip to content

Commit bca8c8f

Browse files
committed
#153: Changed the default OpenAI model & applied a static role to the stream deltas
1 parent e203ecd commit bca8c8f

File tree

4 files changed

+3
-3
lines changed

4 files changed

+3
-3
lines changed

pkg/api/http/handlers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ func LangStreamChatHandler(tel *telemetry.Telemetry, routerManager *routers.Rout
137137
var chatRequest schemas.ChatStreamRequest
138138

139139
if err = c.ReadJSON(&chatRequest); err != nil {
140+
// TODO: handle bad request schemas gracefully and return back validation errors
140141
if websocket.IsUnexpectedCloseError(err, websocket.CloseNormalClosure, websocket.CloseGoingAway) {
141142
tel.L().Warn("Streaming Chat connection is closed", zap.Error(err), zap.String("routerID", routerID))
142143
}

pkg/providers/bedrock/chat.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ func (c *Client) doChatRequest(ctx context.Context, payload *ChatRequest) (*sche
103103
ModelName: c.config.ModelName,
104104
Cached: false,
105105
ModelResponse: schemas.ModelResponse{
106-
Metadata: map[string]string{},
107106
Message: schemas.ChatMessage{
108107
Role: "assistant",
109108
Content: modelResult.OutputText,

pkg/providers/openai/chat_stream.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (s *ChatStream) Recv() (*schemas.ChatStreamChunk, error) {
120120
"generated_at": completionChunk.Created,
121121
},
122122
Message: schemas.ChatMessage{
123-
Role: responseChunk.Delta.Role,
123+
Role: "assistant", // doesn't present in all chunks
124124
Content: responseChunk.Delta.Content,
125125
},
126126
},

pkg/providers/openai/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func DefaultConfig() *Config {
5656
return &Config{
5757
BaseURL: "https://api.openai.com/v1",
5858
ChatEndpoint: "/chat/completions",
59-
ModelName: "gpt-3.5-turbo",
59+
ModelName: "gpt-4o",
6060
DefaultParams: &defaultParams,
6161
}
6262
}

0 commit comments

Comments
 (0)