feat(ml): fuse two embedding models and protect the ML service with a token
This commit is contained in:
1 parent
bc00d6901f
commit
b24e5ff906
63 files changed
+2287
-276
No files matched your search
@@ -12,6 +12,31 @@ func (s *ProblemStatusCode) Error() string {
|
||||
return fmt.Sprintf("code %d: %+v", s.StatusCode, s.Response)
|
||||
}
|
||||
|
||||
type BearerAuth struct {
|
||||
Token string
|
||||
Roles []string
|
||||
}
|
||||
|
||||
// GetToken returns the value of Token.
|
||||
func (s *BearerAuth) GetToken() string {
|
||||
return s.Token
|
||||
}
|
||||
|
||||
// GetRoles returns the value of Roles.
|
||||
func (s *BearerAuth) GetRoles() []string {
|
||||
return s.Roles
|
||||
}
|
||||
|
||||
// SetToken sets the value of Token.
|
||||
func (s *BearerAuth) SetToken(val string) {
|
||||
s.Token = val
|
||||
}
|
||||
|
||||
// SetRoles sets the value of Roles.
|
||||
func (s *BearerAuth) SetRoles(val []string) {
|
||||
s.Roles = val
|
||||
}
|
||||
|
||||
type CreateMLEmbeddingsBadRequest ProblemStatusCode
|
||||
|
||||
func (*CreateMLEmbeddingsBadRequest) createMLEmbeddingsRes() {}
|
||||
@@ -24,6 +49,10 @@ type CreateMLEmbeddingsServiceUnavailable ProblemStatusCode
|
||||
|
||||
func (*CreateMLEmbeddingsServiceUnavailable) createMLEmbeddingsRes() {}
|
||||
|
||||
type CreateMLEmbeddingsUnauthorized ProblemStatusCode
|
||||
|
||||
func (*CreateMLEmbeddingsUnauthorized) createMLEmbeddingsRes() {}
|
||||
|
||||
// Side of the retrieval pair that the texts belong to. The service owns the prompt of each side, so
|
||||
// callers never send model instructions.
|
||||
//
|
||||
@@ -143,13 +172,14 @@ func (s *EmbeddingModel) SetPromptVersion(val string) {
|
||||
|
||||
// Texts to encode in one call. The service encodes them in a fixed, deterministic way: texts are
|
||||
// ordered by length with the request position as the tie-breaker, encoded in micro-batches of the
|
||||
// configured size, and returned in request order. The same texts in the same request on the same image
|
||||
// and thread count give the same vectors.
|
||||
// configured size, and returned in request order. The same texts in the same request on the same
|
||||
// installation, device, precision, and thread count give the same vectors.
|
||||
// Ref: #/components/schemas/EmbeddingRequest
|
||||
type EmbeddingRequest struct {
|
||||
// Identifier of the model to use, as `EmbeddingModel.id` reports it. Absent means the default model of
|
||||
// the service. A service may load several models, for example the members of an ensemble; a model it
|
||||
// does not serve answers 400 validation_failed with the pointer `/model`.
|
||||
// the service, the first one it is configured with. A service may load several models, for example the
|
||||
// members of an ensemble; a model it does not serve answers 400 validation_failed with the pointer
|
||||
// `/model`.
|
||||
Model OptString `json:"model"`
|
||||
Kind EmbeddingInputKind `json:"kind"`
|
||||
Texts []EmbeddingText `json:"texts"`
|
||||
|
||||
Reference in new issue
Block a user