Matt Low
a2c860252f
Moved `ChangeCompletionInterface` to `pkg/api`, moved individual providers to `pkg/api/provider`
36 lines
835 B
Go
36 lines
835 B
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.mlow.ca/mlow/lmcli/pkg/lmcli/model"
|
|
)
|
|
|
|
type ReplyCallback func(model.Message)
|
|
|
|
type Chunk struct {
|
|
Content string
|
|
}
|
|
|
|
type ChatCompletionClient interface {
|
|
// CreateChatCompletion requests a response to the provided messages.
|
|
// Replies are appended to the given replies struct, and the
|
|
// complete user-facing response is returned as a string.
|
|
CreateChatCompletion(
|
|
ctx context.Context,
|
|
params model.RequestParameters,
|
|
messages []model.Message,
|
|
callback ReplyCallback,
|
|
) (string, error)
|
|
|
|
// Like CreateChageCompletion, except the response is streamed via
|
|
// the output channel as it's received.
|
|
CreateChatCompletionStream(
|
|
ctx context.Context,
|
|
params model.RequestParameters,
|
|
messages []model.Message,
|
|
callback ReplyCallback,
|
|
output chan<- Chunk,
|
|
) (string, error)
|
|
}
|