Split anthropic types out to types.go
This commit is contained in:
parent
ffe9d299ef
commit
1b9a8f319c
@ -15,43 +15,6 @@ import (
|
|||||||
"git.mlow.ca/mlow/lmcli/pkg/lmcli/tools"
|
"git.mlow.ca/mlow/lmcli/pkg/lmcli/tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AnthropicClient struct {
|
|
||||||
APIKey string
|
|
||||||
}
|
|
||||||
|
|
||||||
type Message struct {
|
|
||||||
Role string `json:"role"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Request struct {
|
|
||||||
Model string `json:"model"`
|
|
||||||
Messages []Message `json:"messages"`
|
|
||||||
System string `json:"system,omitempty"`
|
|
||||||
MaxTokens int `json:"max_tokens,omitempty"`
|
|
||||||
StopSequences []string `json:"stop_sequences,omitempty"`
|
|
||||||
Stream bool `json:"stream,omitempty"`
|
|
||||||
Temperature float32 `json:"temperature,omitempty"`
|
|
||||||
//TopP float32 `json:"top_p,omitempty"`
|
|
||||||
//TopK float32 `json:"top_k,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type OriginalContent struct {
|
|
||||||
Type string `json:"type"`
|
|
||||||
Text string `json:"text"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Response struct {
|
|
||||||
Id string `json:"id"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
Role string `json:"role"`
|
|
||||||
Content []OriginalContent `json:"content"`
|
|
||||||
StopReason string `json:"stop_reason"`
|
|
||||||
StopSequence string `json:"stop_sequence"`
|
|
||||||
}
|
|
||||||
|
|
||||||
const FUNCTION_STOP_SEQUENCE = "</function_calls>"
|
|
||||||
|
|
||||||
func buildRequest(params model.RequestParameters, messages []model.Message) Request {
|
func buildRequest(params model.RequestParameters, messages []model.Message) Request {
|
||||||
requestBody := Request{
|
requestBody := Request{
|
||||||
Model: params.Model,
|
Model: params.Model,
|
||||||
|
@ -9,6 +9,8 @@ import (
|
|||||||
"git.mlow.ca/mlow/lmcli/pkg/lmcli/model"
|
"git.mlow.ca/mlow/lmcli/pkg/lmcli/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const FUNCTION_STOP_SEQUENCE = "</function_calls>"
|
||||||
|
|
||||||
const TOOL_PREAMBLE = `You have access to the following tools when replying.
|
const TOOL_PREAMBLE = `You have access to the following tools when replying.
|
||||||
|
|
||||||
You may call them like this:
|
You may call them like this:
|
||||||
|
37
pkg/lmcli/provider/anthropic/types.go
Normal file
37
pkg/lmcli/provider/anthropic/types.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package anthropic
|
||||||
|
|
||||||
|
type AnthropicClient struct {
|
||||||
|
APIKey string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Message struct {
|
||||||
|
Role string `json:"role"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Request struct {
|
||||||
|
Model string `json:"model"`
|
||||||
|
Messages []Message `json:"messages"`
|
||||||
|
System string `json:"system,omitempty"`
|
||||||
|
MaxTokens int `json:"max_tokens,omitempty"`
|
||||||
|
StopSequences []string `json:"stop_sequences,omitempty"`
|
||||||
|
Stream bool `json:"stream,omitempty"`
|
||||||
|
Temperature float32 `json:"temperature,omitempty"`
|
||||||
|
//TopP float32 `json:"top_p,omitempty"`
|
||||||
|
//TopK float32 `json:"top_k,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type OriginalContent struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
Text string `json:"text"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Response struct {
|
||||||
|
Id string `json:"id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Role string `json:"role"`
|
||||||
|
Content []OriginalContent `json:"content"`
|
||||||
|
StopReason string `json:"stop_reason"`
|
||||||
|
StopSequence string `json:"stop_sequence"`
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user