kozmoresourcemanagersdk

package
v0.0.0-...-9e48597 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AI_AGENT_MODEL_CONFIG_FIELD_SUFFIX            = "suffix"
	AI_AGENT_MODEL_CONFIG_FIELD_MAX_TOKENS        = "maxTokens"
	AI_AGENT_MODEL_CONFIG_FIELD_TEMPERATURE       = "temperature"
	AI_AGENT_MODEL_CONFIG_FIELD_TOP_P             = "topP"
	AI_AGENT_MODEL_CONFIG_FIELD_N                 = "n"
	AI_AGENT_MODEL_CONFIG_FIELD_STREAM            = "stream"
	AI_AGENT_MODEL_CONFIG_FIELD_LOGPROBS          = "logprobs"
	AI_AGENT_MODEL_CONFIG_FIELD_ECHO              = "echo"
	AI_AGENT_MODEL_CONFIG_FIELD_STOP              = "stop"
	AI_AGENT_MODEL_CONFIG_FIELD_PRESENCE_PENALTY  = "presencePenalty"
	AI_AGENT_MODEL_CONFIG_FIELD_FREQUENCY_PENALTY = "frequencyPenalty"
	AI_AGENT_MODEL_CONFIG_FIELD_BEST_OF           = "bestOf"
	AI_AGENT_MODEL_CONFIG_FIELD_LOGIT_BIAS        = "logitBias"
	AI_AGENT_MODEL_CONFIG_FIELD_USER              = "user"
)
View Source
const (
	AIAGENTPROMPTVARIABLE_FIELD_KEY           = "key"
	AIAGENTPROMPTVARIABLE_FIELD_VALUE         = "value"
	AIAGENTPROMPTVARIABLE_FIELD_DEFAULT_VALUE = "defaultValue"
)
View Source
const (
	BASEURL = "http://127.0.0.1:8008/api/v1"
	// api route part
	GET_AI_AGENT_INTERNAL_API                    = "/api/v1/aiAgent/%d"
	RUN_AI_AGENT_INTERNAL_API                    = "/api/v1/aiAgent/%d/run"
	DELETE_TEAM_ALL_AI_AGENT_INTERNAL_API        = "/api/v1/teams/%d/aiAgent/all"
	FORK_MARKETPLACE_AI_AGENT_INTERNAL_API       = "/api/v1/aiAgent/%d/forkTo/teams/%d/by/users/%d"
	PUBLISH_AI_AGENT_TO_MARKETPLACE_INTERNAL_API = "/api/v1/teams/%d/aiAgent/%d"
)
View Source
const (
	PRODUCT_TYPE_AIAGENTS = "aiAgents"
	PRODUCT_TYPE_APPS     = "apps"
	PRODUCT_TYPE_HUBS     = "hubs"
)
View Source
const (
	RUN_AI_AGENT_REQUEST_FIELD_TEAM_ID          = "teamID"
	RUN_AI_AGENT_REQUEST_FIELD_RESOURCE_ID      = "resourceID"
	RUN_AI_AGENT_REQUEST_FIELD_AI_AGENT_ID      = "aiAgentID"
	RUN_AI_AGENT_REQUEST_FIELD_AUTHORIZATION    = "authorization"
	RUN_AI_AGENT_REQUEST_FIELD_RUN_BY_ANONYMOUS = "runByAnonymous"
	RUN_AI_AGENT_REQUEST_FIELD_AGENT_TYPE       = "agentType"
	RUN_AI_AGENT_REQUEST_FIELD_MODEL            = "model"
	RUN_AI_AGENT_REQUEST_FIELD_VARIABLES        = "variables"
	RUN_AI_AGENT_REQUEST_FIELD_MODEL_CONFIG     = "modelConfig"
	RUN_AI_AGENT_REQUEST_FIELD_INPUT            = "input"
)
View Source
const (
	RUN_RESOURCE_RESULT_FIELD_PAYLOAD = "payload"
)

Variables

This section is empty.

Functions

func NewkozmoResourceManagerRestAPI

func NewkozmoResourceManagerRestAPI() (*kozmoResourceManagerRestAPI, error)

Types

type AIAgentForExport

type AIAgentForExport struct {
	ID                     string                 `json:"aiAgentID"`
	UID                    uuid.UUID              `json:"uid"`
	TeamID                 string                 `json:"teamID"`
	TeamName               string                 `json:"teamName"`
	TeamIcon               string                 `json:"teamIcon"`
	TeamIdentifier         string                 `json:"teamIdentifier"`
	Name                   string                 `json:"name"`
	Model                  int                    `json:"model"`
	AgentType              int                    `json:"agentType"`
	PublishedToMarketplace bool                   `json:"publishedToMarketplace"`
	Icon                   string                 `json:"icon"`
	Description            string                 `json:"description"`
	Prompt                 string                 `json:"prompt"`
	Variables              []interface{}          `json:"variables"`
	ModelConfig            map[string]interface{} `json:"modelConfig"`
	CreatedAt              time.Time              `json:"createdAt"`
	CreatedBy              string                 `json:"createdBy"`
	UpdatedAt              time.Time              `json:"updatedAt"`
	UpdatedBy              string                 `json:"updatedBy"`
	EditedBy               []interface{}          `json:"editedBy"`
}

func (*AIAgentForExport) ExportIDInInt

func (i *AIAgentForExport) ExportIDInInt() int

type AIAgentModelConfig

type AIAgentModelConfig struct {
	Suffix           string                 `json:"suffix"`            // default is null
	MaxTokens        int                    `json:"maxTokens"`         // default is 16
	Temperature      float64                `json:"temperature"`       // default is 1
	TopP             float64                `json:"top_p"`             // default is 1
	N                float64                `json:"n"`                 // default is 1
	Stream           bool                   `json:"stream"`            // default is false
	Logprobs         float64                `json:"logprobs"`          // default is 0
	Echo             bool                   `json:"echo"`              // default is false
	Stop             []string               `jsonstop"`                // default is null
	PresencePenalty  float64                `json:"presence_penalty"`  // default is 0
	FrequencyPenalty float64                `json:"frequency_penalty"` // default is 0
	BestOf           float64                `json:"best_of"`           // default is 1
	LogitBias        map[string]interface{} `json:"logit_bias"`        // default is null
	User             string                 `json:"user"`              // default is null
	SettedMap        *AIAgentModelConfigSettedMap
}

func NewAIAgentModelConfigByMap

func NewAIAgentModelConfigByMap(rawRequest map[string]interface{}) (*AIAgentModelConfig, error)

func ReflectAIAgentModelConfigManually

func ReflectAIAgentModelConfigManually(aiAgentModelConfig *AIAgentModelConfig, rawRequest map[string]interface{}) (*AIAgentModelConfig, error)

only reflect field: maxTokens, temperature, stream

type AIAgentModelConfigSettedMap

type AIAgentModelConfigSettedMap struct {
	Suffix           bool
	MaxTokens        bool
	Temperature      bool
	TopP             bool
	N                bool
	Stream           bool
	Logprobs         bool
	Echo             bool
	Stop             bool
	PresencePenalty  bool
	FrequencyPenalty bool
	BestOf           bool
	LogitBias        bool
	User             bool
}

type AIAgentPromptVariable

type AIAgentPromptVariable struct {
	Key          string `json:"key"`
	Value        string `json:"value"`
	DefaultValue string `json:"defaultValue"`
}

func NewAIAgentPromptVariableByMap

func NewAIAgentPromptVariableByMap(rawData map[string]interface{}) (*AIAgentPromptVariable, error)

type PublishAIAgentToMarketplaceInternalRequest

type PublishAIAgentToMarketplaceInternalRequest struct {
	PublishedToMarketplace bool `json:"publishedToMarketplace"      `
	UserID                 int  `json:"userID"        validate:"required"`
}

func NewPublishAIAgentToMarketplaceInternalRequest

func NewPublishAIAgentToMarketplaceInternalRequest() *PublishAIAgentToMarketplaceInternalRequest

func NewPublishAIAgentToMarketplaceInternalRequestWithParam

func NewPublishAIAgentToMarketplaceInternalRequestWithParam(publishedToMarketplace bool, userID int) *PublishAIAgentToMarketplaceInternalRequest

func (*PublishAIAgentToMarketplaceInternalRequest) ExportInJSONString

func (req *PublishAIAgentToMarketplaceInternalRequest) ExportInJSONString() string

type RunAIAgentRequest

type RunAIAgentRequest struct {
	TeamID         int                      `json:"-"`
	AIAgentID      int                      `json:"-"` // alias of "resourceID"
	Authorization  string                   `json:"-"`
	RunByAnonymous bool                     `json:"runByAnonymous"`
	AgentType      int                      `json:"agentType"`
	Model          int                      `json:"model"`
	Variables      []*AIAgentPromptVariable `json:"variables"`
	ModelConfig    *AIAgentModelConfig      `json:"modelConfig"`
	Input          string                   `json:"input"`
}

the request json like

{
    "agentType": 2,
    "model": 1,
    "variables":  [{"key":"key1", "value":"12"}, {"key":"key2", "value":"apple"}],
    "modelConfig": {"maxTokens": 100, "stream": false},
    "input": "can you tell me a story"
}

func NewRunAIAgentRequest

func NewRunAIAgentRequest(rawRequest map[string]interface{}) (*RunAIAgentRequest, error)

func (*RunAIAgentRequest) ExportAIAgentIDInInt

func (req *RunAIAgentRequest) ExportAIAgentIDInInt() int

func (*RunAIAgentRequest) ExportAIAgentIDInMagicString

func (req *RunAIAgentRequest) ExportAIAgentIDInMagicString() string

func (*RunAIAgentRequest) ExportAuthorization

func (req *RunAIAgentRequest) ExportAuthorization() string

func (*RunAIAgentRequest) ExportRequestToken

func (req *RunAIAgentRequest) ExportRequestToken() string

func (*RunAIAgentRequest) ExportTeamIDInInt

func (req *RunAIAgentRequest) ExportTeamIDInInt() int

func (*RunAIAgentRequest) ExportTeamIDInMagicString

func (req *RunAIAgentRequest) ExportTeamIDInMagicString() string

func (*RunAIAgentRequest) IsRunByAnonymous

func (req *RunAIAgentRequest) IsRunByAnonymous() bool

type RunResourceResult

type RunResourceResult struct {
	Payload string `json:"payload"`
}

the result json like

{ "payload": "Once upon a time in the beautiful village of Fruitland, there lived a young girl named Apple. Apple was known for her vibrant red hair that matched the color of the apples that grew abundantly in her family's orchard. She was full of curiosity and had a heart full of kindness.\n\nApple had always dreamt of exploring the world beyond Fruitland. She had heard countless stories from her grandparents about faraway lands filled with magical creatures and stunning landscapes. Yearning for adventure, she embarked on" }

func NewRunResourceResult

func NewRunResourceResult() *RunResourceResult

func (*RunResourceResult) ExportAsContent

func (i *RunResourceResult) ExportAsContent() map[string]interface{}

func (*RunResourceResult) ExportPayload

func (i *RunResourceResult) ExportPayload() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL