Merge remote-tracking branch 'origin/upstream/main'

This commit is contained in:
Laisky.Cai
2024-02-19 07:23:30 +00:00
71 changed files with 2003 additions and 2097 deletions

View File

@@ -1,71 +1,71 @@
package ali
type Message struct {
Content string `json:"content"`
Role string `json:"role"`
}
// type Message struct {
// Content string `json:"content"`
// Role string `json:"role"`
// }
type Input struct {
//Prompt string `json:"prompt"`
Messages []Message `json:"messages"`
}
// type Input struct {
// //Prompt string `json:"prompt"`
// Messages []Message `json:"messages"`
// }
type Parameters 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 Parameters 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 ChatRequest struct {
Model string `json:"model"`
Input Input `json:"input"`
Parameters Parameters `json:"parameters,omitempty"`
}
// type ChatRequest struct {
// Model string `json:"model"`
// Input Input `json:"input"`
// Parameters Parameters `json:"parameters,omitempty"`
// }
type EmbeddingRequest 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 EmbeddingRequest 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 Embedding struct {
Embedding []float64 `json:"embedding"`
TextIndex int `json:"text_index"`
}
// type Embedding struct {
// Embedding []float64 `json:"embedding"`
// TextIndex int `json:"text_index"`
// }
type EmbeddingResponse struct {
Output struct {
Embeddings []Embedding `json:"embeddings"`
} `json:"output"`
Usage Usage `json:"usage"`
Error
}
// type EmbeddingResponse struct {
// Output struct {
// Embeddings []Embedding `json:"embeddings"`
// } `json:"output"`
// Usage Usage `json:"usage"`
// Error
// }
type Error struct {
Code string `json:"code"`
Message string `json:"message"`
RequestId string `json:"request_id"`
}
// type Error struct {
// Code string `json:"code"`
// Message string `json:"message"`
// RequestId string `json:"request_id"`
// }
type Usage struct {
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
TotalTokens int `json:"total_tokens"`
}
// type Usage struct {
// InputTokens int `json:"input_tokens"`
// OutputTokens int `json:"output_tokens"`
// TotalTokens int `json:"total_tokens"`
// }
type Output struct {
Text string `json:"text"`
FinishReason string `json:"finish_reason"`
}
// type Output struct {
// Text string `json:"text"`
// FinishReason string `json:"finish_reason"`
// }
type ChatResponse struct {
Output Output `json:"output"`
Usage Usage `json:"usage"`
Error
}
// type ChatResponse struct {
// Output Output `json:"output"`
// Usage Usage `json:"usage"`
// Error
// }