Skip to content

Commit

Permalink
265: pushing wip. Need clarification on role response logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-fitz committed Jun 17, 2024
1 parent 516457b commit 201ef76
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 58 deletions.
2 changes: 1 addition & 1 deletion pkg/providers/cohere/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (c *Client) doChatRequest(ctx context.Context, payload *ChatRequest) (*sche
"responseId": cohereCompletion.ResponseID,
},
Message: schemas.ChatMessage{
Role: payload.ChatHistory[len(payload.ChatHistory)-1].Role,
Role: payload.Role,
Content: cohereCompletion.Text,
},
TokenUsage: schemas.TokenUsage{
Expand Down
2 changes: 2 additions & 0 deletions pkg/providers/cohere/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ type FinalResponse struct {
type ChatRequest struct {
Model string `json:"model"`
Message string `json:"message"`
Role schemas.Role `json:"role"`
ChatHistory []schemas.ChatMessage `json:"chat_history"`
Temperature float64 `json:"temperature,omitempty"`
Preamble string `json:"preamble,omitempty"`
Expand Down Expand Up @@ -131,6 +132,7 @@ func (r *ChatRequest) ApplyParams(params *schemas.ChatParams) {

message.Role = schemas.Role(mapRole(message.Role))

r.Role = message.Role
r.Message = message.Content
r.ChatHistory = messageHistory
}
Expand Down
57 changes: 0 additions & 57 deletions pkg/providers/cohere/schemas_test.go

This file was deleted.

0 comments on commit 201ef76

Please sign in to comment.