dto.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package cohere
  2. type CohereRequest struct {
  3. Model string `json:"model"`
  4. ChatHistory []ChatHistory `json:"chat_history"`
  5. Message string `json:"message"`
  6. Stream bool `json:"stream"`
  7. MaxTokens int64 `json:"max_tokens"`
  8. }
  9. type ChatHistory struct {
  10. Role string `json:"role"`
  11. Message string `json:"message"`
  12. }
  13. type CohereResponse struct {
  14. IsFinished bool `json:"is_finished"`
  15. EventType string `json:"event_type"`
  16. Text string `json:"text,omitempty"`
  17. FinishReason string `json:"finish_reason,omitempty"`
  18. Response *CohereResponseResult `json:"response"`
  19. }
  20. type CohereResponseResult struct {
  21. ResponseId string `json:"response_id"`
  22. FinishReason string `json:"finish_reason,omitempty"`
  23. Text string `json:"text"`
  24. Meta CohereMeta `json:"meta"`
  25. }
  26. type CohereMeta struct {
  27. //Tokens CohereTokens `json:"tokens"`
  28. BilledUnits CohereBilledUnits `json:"billed_units"`
  29. }
  30. type CohereBilledUnits struct {
  31. InputTokens int `json:"input_tokens"`
  32. OutputTokens int `json:"output_tokens"`
  33. }
  34. type CohereTokens struct {
  35. InputTokens int `json:"input_tokens"`
  36. OutputTokens int `json:"output_tokens"`
  37. }