diff --git a/neo/assistant/api.go b/neo/assistant/api.go index 75e2d725..dd112f79 100644 --- a/neo/assistant/api.go +++ b/neo/assistant/api.go @@ -87,9 +87,10 @@ func (ast *Assistant) execute(c *gin.Context, ctx chatctx.Context, userInput int } options := ast.withOptions(userOptions) - // Add RAG and Version support + // Add RAG、Vision and Search support ctx.RAG = rag != nil - ctx.Version = ast.vision + ctx.Vision = ast.vision + ctx.Search = ast.search && search != nil // Run init hook res, err := ast.HookCreate(c, ctx, input, options, contents) diff --git a/neo/assistant/load.go b/neo/assistant/load.go index 2c90726d..7258c3e2 100644 --- a/neo/assistant/load.go +++ b/neo/assistant/load.go @@ -25,6 +25,7 @@ import ( var loaded = NewCache(200) // 200 is the default capacity var storage store.Store = nil var rag *RAG = nil +var search *Search = nil var connectorSettings map[string]ConnectorSetting = map[string]ConnectorSetting{} var vision *neovision.Vision = nil var defaultConnector string = "" // default connector diff --git a/neo/assistant/types.go b/neo/assistant/types.go index 3a533448..fa6dc8aa 100644 --- a/neo/assistant/types.go +++ b/neo/assistant/types.go @@ -84,6 +84,12 @@ type RAG struct { Setting RAGSetting } +// Search the search interface +// @todo: add search engine +type Search struct { + Engine interface{} +} + // RAGSetting the RAG setting type RAGSetting struct { IndexPrefix string `json:"index_prefix" yaml:"index_prefix"` @@ -129,6 +135,7 @@ type Assistant struct { UpdatedAt int64 `json:"updated_at"` // Last update timestamp openai *api.OpenAI // OpenAI API vision bool // Whether this assistant supports vision + search bool // Whether this assistant supports search toolCalls bool // Whether this assistant supports tool_calls initHook bool // Whether this assistant has an init hook } diff --git a/neo/context/context.go b/neo/context/context.go index 927e55bb..2fc69eef 100644 --- a/neo/context/context.go +++ b/neo/context/context.go @@ -28,10 +28,11 @@ type Context struct { Retry bool `json:"retry,omitempty"` // Retry mode RetryTimes uint8 `json:"retry_times,omitempty"` // Retry times Upload *FileUpload `json:"upload,omitempty"` - Version bool `json:"version,omitempty"` // Version support - RAG bool `json:"rag,omitempty"` // RAG support - Args []interface{} `json:"args,omitempty"` // Arguments for call - SharedSpace plan.Space `json:"-"` // Shared space + Vision bool `json:"vision,omitempty"` // Vision support + Search bool `json:"search,omitempty"` // Search support + RAG bool `json:"rag,omitempty"` // RAG support + Args []interface{} `json:"args,omitempty"` // Arguments for call + SharedSpace plan.Space `json:"-"` // Shared space } // Field the context field @@ -181,9 +182,10 @@ func (ctx *Context) Release() { // Map the context to a map func (ctx *Context) Map() map[string]interface{} { data := map[string]interface{}{ - "sid": ctx.Sid, - "rag": ctx.RAG, - "version": ctx.Version, + "sid": ctx.Sid, + "rag": ctx.RAG, + "vision": ctx.Vision, + "search": ctx.Search, } if ctx.ChatID != "" {