-
Notifications
You must be signed in to change notification settings - Fork 20
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
#42 init router config #48
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #48 +/- ##
===========================================
+ Coverage 62.92% 67.52% +4.60%
===========================================
Files 5 8 +3
Lines 89 234 +145
===========================================
+ Hits 56 158 +102
- Misses 30 65 +35
- Partials 3 11 +8 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes so far look quite good. Nice to see all this come together.
|
||
resp, err := c.createChatHTTP(r, u) | ||
// TODO: this is suspicious we do zero remapping of OpenAI response and send it back as is. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I need to update per our discussion of unified response. Will be working on mapping this week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's good to know then I'm leaving this spot without changes
} | ||
|
||
// UnifiedChatResponse defines Glide's Chat Response Schema unified across all language models | ||
type UnifiedChatResponse struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be updated to match unified response in the GEP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous UnifiedChatRequest looked like this:
type UnifiedAPIData struct {
// Model string `json:"model"`
// APIKey string `json:"api_key"`
// Params map[string]interface{} `json:"params"`
Message map[string]string `json:"message"`
MessageHistory []map[string]string `json:"messageHistory"`
}
Since that schema is going to be used in Glide API to validate incoming requests, I though it would be better to have it more specific then just map[string]string
. So I looked through other context and come up with this definition.
I was not 100% sure it's good for us, so I wanted to double check with you if that make sense.
c.Telemetry.Logger.Info("running createChatHttp") | ||
func (c *Client) createChatRequestSchema(request *schemas.UnifiedChatRequest) *ChatRequest { | ||
// TODO: consider using objectpool to optimize memory allocation | ||
chatRequest := c.chatRequestTemplate // hoping to get a copy of the template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you have in mind for the template? Is it different from the ChatRequest type above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have noticed that most of the chat request object values are well-defined in advance on the client initialization ('cause they are passed via configs and nothing changes them afterwards as of now). So I have filled a instance of chat request on the client initialization to just copy it further and change fields that vary like messages.
In any case, it's better to benchmark this code to see if this brings any value (Go supports benchmarking as a special type of tests out of the box which is nit).
# Conflicts: # pkg/config/provider_test.go
Inited the routing configuration & restructured the provider codebase to prepare it for the routing logic
Changes:
provider/openai
codebase. Separated unified schemas to theapi
package.Follow-ups
Testing
Glide Chat API is connected to the underlying client: