feat: Introduce JSON decoding utility functions and update error handling in Claude and OpenAI response structures
This commit is contained in:
@@ -165,8 +165,8 @@ func (c *ClaudeRequest) ParseSystem() []ClaudeMediaMessage {
|
||||
}
|
||||
|
||||
type ClaudeError struct {
|
||||
Type string `json:"type"`
|
||||
Message string `json:"message"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
type ClaudeErrorWithStatusCode struct {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package dto
|
||||
|
||||
type SimpleResponse struct {
|
||||
Usage `json:"usage"`
|
||||
Error OpenAIError `json:"error"`
|
||||
Choices []OpenAITextResponseChoice `json:"choices"`
|
||||
Usage `json:"usage"`
|
||||
Error *OpenAIError `json:"error"`
|
||||
}
|
||||
|
||||
type TextResponse struct {
|
||||
@@ -27,6 +26,7 @@ type OpenAITextResponse struct {
|
||||
Object string `json:"object"`
|
||||
Created int64 `json:"created"`
|
||||
Choices []OpenAITextResponseChoice `json:"choices"`
|
||||
Error *OpenAIError `json:"error"`
|
||||
Usage `json:"usage"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user