mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-17 16:06:38 +08:00
100 lines
2.6 KiB
Go
100 lines
2.6 KiB
Go
package ali
|
|
|
|
type AliMessage struct {
|
|
Content string `json:"content"`
|
|
Role string `json:"role"`
|
|
}
|
|
|
|
type AliInput struct {
|
|
Prompt string `json:"prompt,omitempty"`
|
|
//History []AliMessage `json:"history,omitempty"`
|
|
Messages []AliMessage `json:"messages"`
|
|
}
|
|
|
|
type AliParameters struct {
|
|
TopP float64 `json:"top_p,omitempty"`
|
|
TopK int `json:"top_k,omitempty"`
|
|
Seed uint64 `json:"seed,omitempty"`
|
|
EnableSearch bool `json:"enable_search,omitempty"`
|
|
IncrementalOutput bool `json:"incremental_output,omitempty"`
|
|
}
|
|
|
|
type AliChatRequest struct {
|
|
Model string `json:"model"`
|
|
Input AliInput `json:"input,omitempty"`
|
|
Parameters AliParameters `json:"parameters,omitempty"`
|
|
}
|
|
|
|
type AliEmbeddingRequest struct {
|
|
Model string `json:"model"`
|
|
Input struct {
|
|
Texts []string `json:"texts"`
|
|
} `json:"input"`
|
|
Parameters *struct {
|
|
TextType string `json:"text_type,omitempty"`
|
|
} `json:"parameters,omitempty"`
|
|
}
|
|
|
|
type AliEmbedding struct {
|
|
Embedding []float64 `json:"embedding"`
|
|
TextIndex int `json:"text_index"`
|
|
}
|
|
|
|
type AliEmbeddingResponse struct {
|
|
Output struct {
|
|
Embeddings []AliEmbedding `json:"embeddings"`
|
|
} `json:"output"`
|
|
Usage AliUsage `json:"usage"`
|
|
AliError
|
|
}
|
|
|
|
type AliError struct {
|
|
Code string `json:"code"`
|
|
Message string `json:"message"`
|
|
RequestId string `json:"request_id"`
|
|
}
|
|
|
|
type AliUsage struct {
|
|
InputTokens int `json:"input_tokens"`
|
|
OutputTokens int `json:"output_tokens"`
|
|
TotalTokens int `json:"total_tokens"`
|
|
}
|
|
|
|
type TaskResult struct {
|
|
B64Image string `json:"b64_image,omitempty"`
|
|
Url string `json:"url,omitempty"`
|
|
Code string `json:"code,omitempty"`
|
|
Message string `json:"message,omitempty"`
|
|
}
|
|
|
|
type AliOutput struct {
|
|
TaskId string `json:"task_id,omitempty"`
|
|
TaskStatus string `json:"task_status,omitempty"`
|
|
Text string `json:"text"`
|
|
FinishReason string `json:"finish_reason"`
|
|
Message string `json:"message,omitempty"`
|
|
Code string `json:"code,omitempty"`
|
|
Results []TaskResult `json:"results,omitempty"`
|
|
}
|
|
|
|
type AliResponse struct {
|
|
Output AliOutput `json:"output"`
|
|
Usage AliUsage `json:"usage"`
|
|
AliError
|
|
}
|
|
|
|
type AliImageRequest struct {
|
|
Model string `json:"model"`
|
|
Input struct {
|
|
Prompt string `json:"prompt"`
|
|
NegativePrompt string `json:"negative_prompt,omitempty"`
|
|
} `json:"input"`
|
|
Parameters struct {
|
|
Size string `json:"size,omitempty"`
|
|
N int `json:"n,omitempty"`
|
|
Steps string `json:"steps,omitempty"`
|
|
Scale string `json:"scale,omitempty"`
|
|
} `json:"parameters,omitempty"`
|
|
ResponseFormat string `json:"response_format,omitempty"`
|
|
}
|