You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
refactor(cody): Reshape the CompletionsClient interface (#63358)
This PR refactors the `CompletionsClient` interface, and all the
corresponding call sites. There is no functional change, beyond bundling
several function parameters into a new type.
See `internal/completions/types/types.go`. But the gist is this putting
3x parameters into a single `CompletionRequest` type.
```diff
Complete(
context.Context,
log.Logger
- CompletionsFeature,
- CompletionsVersion,
- CompletionRequestParameters
+ CompletionRequest
) (*CompletionResponse, error)
```
## Why?
As part of reworking the codepath between receiving a completion
request, dispatching it to the right `CompletionsClient` implementation,
and serving the request, I need some "hooks" to inject new information.
In a future PR I plan on adding a `*ServerSideModelConfig` as another
field to the `CompletionRequest`, so that when the `CompletionClient`'s
implementation is trying to serve that request it has any additional
data it needs. (For example, the AWS Bedrock provisioned capacity ARN,
etc.)
## Test plan
Updated existing tests, relying on CI/CD for any other issues.
## Changelog
NA, just some under the hood refactoring that shouldn't impact any
functionality.
@@ -394,7 +401,12 @@ func newStreamingResponseHandler(logger log.Logger, db database.DB, feature type
394
401
// to the client.
395
402
funcnewNonStreamingResponseHandler(logger log.Logger, db database.DB, feature types.CompletionsFeature) func(ctx context.Context, requestParams types.CompletionRequestParameters, version types.CompletionsVersion, cc types.CompletionsClient, w http.ResponseWriter, userStore database.UserStore) {
396
403
returnfunc(ctx context.Context, requestParams types.CompletionRequestParameters, version types.CompletionsVersion, cc types.CompletionsClient, w http.ResponseWriter, userStore database.UserStore) {
0 commit comments