| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package cohere
- import "one-api/dto"
- type CohereRequest struct {
- Model string `json:"model"`
- ChatHistory []ChatHistory `json:"chat_history"`
- Message string `json:"message"`
- Stream bool `json:"stream"`
- MaxTokens int64 `json:"max_tokens"`
- }
- type ChatHistory struct {
- Role string `json:"role"`
- Message string `json:"message"`
- }
- type CohereResponse struct {
- IsFinished bool `json:"is_finished"`
- EventType string `json:"event_type"`
- Text string `json:"text,omitempty"`
- FinishReason string `json:"finish_reason,omitempty"`
- Response *CohereResponseResult `json:"response"`
- }
- type CohereResponseResult struct {
- ResponseId string `json:"response_id"`
- FinishReason string `json:"finish_reason,omitempty"`
- Text string `json:"text"`
- Meta CohereMeta `json:"meta"`
- }
- type CohereRerankRequest struct {
- Documents []any `json:"documents"`
- Query string `json:"query"`
- Model string `json:"model"`
- TopN int `json:"top_n"`
- ReturnDocuments bool `json:"return_documents"`
- }
- type CohereRerankResponseResult struct {
- Results []dto.RerankResponseDocument `json:"results"`
- Meta CohereMeta `json:"meta"`
- }
- type CohereMeta struct {
- //Tokens CohereTokens `json:"tokens"`
- BilledUnits CohereBilledUnits `json:"billed_units"`
- }
- type CohereBilledUnits struct {
- InputTokens int `json:"input_tokens"`
- OutputTokens int `json:"output_tokens"`
- }
- type CohereTokens struct {
- InputTokens int `json:"input_tokens"`
- OutputTokens int `json:"output_tokens"`
- }
|