Documentation
¶
Index ¶
- type CreateModelRequest
- type Model
- type ModelParameters
- type ModelRepo
- func (r *ModelRepo) Create(ctx context.Context, projectID uuid.UUID, req *CreateModelRequest) (*Model, error)
- func (r *ModelRepo) Delete(ctx context.Context, projectID, id uuid.UUID) error
- func (r *ModelRepo) GetByID(ctx context.Context, projectID, id uuid.UUID) (*Model, error)
- func (r *ModelRepo) GetByName(ctx context.Context, projectID uuid.UUID, name string) (*Model, error)
- func (r *ModelRepo) List(ctx context.Context, projectID uuid.UUID, providerType *string) ([]*ModelWithProvider, error)
- func (r *ModelRepo) Update(ctx context.Context, projectID, id uuid.UUID, req *UpdateModelRequest) (*Model, error)
- type ModelService
- func (s *ModelService) Create(ctx context.Context, projectID uuid.UUID, req *CreateModelRequest) (*Model, error)
- func (s *ModelService) Delete(ctx context.Context, projectID, id uuid.UUID) error
- func (s *ModelService) GetByID(ctx context.Context, projectID, id uuid.UUID) (*Model, error)
- func (s *ModelService) GetByName(ctx context.Context, projectID uuid.UUID, name string) (*Model, error)
- func (s *ModelService) List(ctx context.Context, projectID uuid.UUID, providerType *string) ([]*ModelWithProvider, error)
- func (s *ModelService) Update(ctx context.Context, projectID, id uuid.UUID, req *UpdateModelRequest) (*Model, error)
- type ModelWithProvider
- type UpdateModelRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateModelRequest ¶
type CreateModelRequest struct {
ProviderType string `json:"provider_type" validate:"required,oneof=OpenAI Anthropic Gemini xAI"`
Name string `json:"name" validate:"required,min=1,max=255"`
ModelID string `json:"model_id" validate:"required,min=1,max=255"`
Parameters ModelParameters `json:"parameters,omitempty"`
}
CreateModelRequest represents the request to create a new model
type Model ¶
type Model struct {
ID uuid.UUID `json:"id" db:"id"`
ProjectID uuid.UUID `json:"project_id" db:"project_id"`
ProviderType string `json:"provider_type" db:"provider_type"`
Name string `json:"name" db:"name"`
ModelID string `json:"model_id" db:"model_id"` // e.g., "gpt-4.1", "gpt-4o"
Parameters ModelParameters `json:"parameters" db:"parameters"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}
Model represents a model configuration
type ModelParameters ¶
type ModelParameters map[string]interface{}
ModelParameters represents model parameters as a flexible JSON map
func (ModelParameters) MarshalJSON ¶
func (m ModelParameters) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler
func (*ModelParameters) Scan ¶
func (m *ModelParameters) Scan(value interface{}) error
Scan implements the sql.Scanner interface for database/sql
func (*ModelParameters) UnmarshalJSON ¶
func (m *ModelParameters) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler
type ModelRepo ¶
type ModelRepo struct {
// contains filtered or unexported fields
}
ModelRepo handles database operations for models
func NewModelRepo ¶
NewModelRepo creates a new model repository
func (*ModelRepo) Create ¶
func (r *ModelRepo) Create(ctx context.Context, projectID uuid.UUID, req *CreateModelRequest) (*Model, error)
Create creates a new model
func (*ModelRepo) GetByName ¶
func (r *ModelRepo) GetByName(ctx context.Context, projectID uuid.UUID, name string) (*Model, error)
GetByName retrieves a model by name
type ModelService ¶
type ModelService struct {
// contains filtered or unexported fields
}
ModelService handles business logic for models
func NewModelService ¶
func NewModelService(repo *ModelRepo) *ModelService
NewModelService creates a new model service
func (*ModelService) Create ¶
func (s *ModelService) Create(ctx context.Context, projectID uuid.UUID, req *CreateModelRequest) (*Model, error)
Create creates a new model
func (*ModelService) GetByName ¶
func (s *ModelService) GetByName(ctx context.Context, projectID uuid.UUID, name string) (*Model, error)
GetByName retrieves a model by name
func (*ModelService) List ¶
func (s *ModelService) List(ctx context.Context, projectID uuid.UUID, providerType *string) ([]*ModelWithProvider, error)
List retrieves all models with optional filtering
func (*ModelService) Update ¶
func (s *ModelService) Update(ctx context.Context, projectID, id uuid.UUID, req *UpdateModelRequest) (*Model, error)
Update updates a model
type ModelWithProvider ¶
type ModelWithProvider struct {
Model
ProviderType string `json:"provider_type" db:"provider_type"`
}
ModelWithProvider includes provider information
type UpdateModelRequest ¶
type UpdateModelRequest struct {
ProviderType *string `json:"provider_type,omitempty" validate:"omitempty,oneof=OpenAI Anthropic Gemini xAI"`
Name *string `json:"name,omitempty" validate:"omitempty,min=1,max=255"`
ModelID *string `json:"model_id,omitempty" validate:"omitempty,min=1,max=255"`
Parameters *ModelParameters `json:"parameters,omitempty"`
}
UpdateModelRequest represents the request to update a model