mirror of
				https://github.com/kardolus/chatgpt-cli.git
				synced 2024-09-08 23:15:00 +03:00 
			
		
		
		
	Refactor Query function to include token usage in response
This commit is contained in:
		| @@ -17,18 +17,20 @@ type Message struct { | ||||
| } | ||||
|  | ||||
| type CompletionsResponse struct { | ||||
| 	ID      string `json:"id"` | ||||
| 	Object  string `json:"object"` | ||||
| 	Created int    `json:"created"` | ||||
| 	Model   string `json:"model"` | ||||
| 	Usage   struct { | ||||
| 		PromptTokens     int `json:"prompt_tokens"` | ||||
| 		CompletionTokens int `json:"completion_tokens"` | ||||
| 		TotalTokens      int `json:"total_tokens"` | ||||
| 	} `json:"usage"` | ||||
| 	ID      string   `json:"id"` | ||||
| 	Object  string   `json:"object"` | ||||
| 	Created int      `json:"created"` | ||||
| 	Model   string   `json:"model"` | ||||
| 	Usage   Usage    `json:"usage"` | ||||
| 	Choices []Choice `json:"choices"` | ||||
| } | ||||
|  | ||||
| type Usage struct { | ||||
| 	PromptTokens     int `json:"prompt_tokens"` | ||||
| 	CompletionTokens int `json:"completion_tokens"` | ||||
| 	TotalTokens      int `json:"total_tokens"` | ||||
| } | ||||
|  | ||||
| type Choice struct { | ||||
| 	Message      Message `json:"message"` | ||||
| 	FinishReason string  `json:"finish_reason"` | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 kardolus
					kardolus