diff --git a/example/webui/sse.go b/core/sse/sse.go similarity index 99% rename from example/webui/sse.go rename to core/sse/sse.go index eab37be..b4b5093 100644 --- a/example/webui/sse.go +++ b/core/sse/sse.go @@ -1,4 +1,4 @@ -package main +package sse import ( "bufio" diff --git a/example/webui/agentconfig.go b/core/state/config.go similarity index 86% rename from example/webui/agentconfig.go rename to core/state/config.go index ea0b8e3..b91c308 100644 --- a/example/webui/agentconfig.go +++ b/core/state/config.go @@ -1,4 +1,8 @@ -package main +package state + +import ( + "github.com/mudler/local-agent-framework/core/agent" +) type ConnectorConfig struct { Type string `json:"type"` // e.g. Slack @@ -31,3 +35,9 @@ type AgentConfig struct { LongTermMemory bool `json:"long_term_memory" form:"long_term_memory"` SummaryLongTermMemory bool `json:"summary_long_term_memory" form:"summary_long_term_memory"` } + +type Connector interface { + AgentResultCallback() func(state agent.ActionState) + AgentReasoningCallback() func(state agent.ActionCurrentState) bool + Start(a *agent.Agent) +} diff --git a/example/webui/rag.go b/core/state/memory.go similarity index 99% rename from example/webui/rag.go rename to core/state/memory.go index d7479e0..ad9be97 100644 --- a/example/webui/rag.go +++ b/core/state/memory.go @@ -1,4 +1,4 @@ -package main +package state import ( "encoding/json" diff --git a/example/webui/agentpool.go b/core/state/pool.go similarity index 76% rename from example/webui/agentpool.go rename to core/state/pool.go index 685cd98..628a4a6 100644 --- a/example/webui/agentpool.go +++ b/core/state/pool.go @@ -1,4 +1,4 @@ -package main +package state import ( "context" @@ -11,39 +11,44 @@ import ( "time" "github.com/mudler/local-agent-framework/core/agent" - "github.com/mudler/local-agent-framework/pkg/xlog" - . "github.com/mudler/local-agent-framework/core/agent" + "github.com/mudler/local-agent-framework/core/sse" + "github.com/mudler/local-agent-framework/pkg/utils" + + "github.com/mudler/local-agent-framework/pkg/xlog" ) type AgentPool struct { sync.Mutex - file string - pooldir string - pool AgentPoolData - agents map[string]*Agent - managers map[string]Manager - agentStatus map[string]*Status - agentMemory map[string]*InMemoryDatabase - apiURL, model string - ragDB RAGDB + file string + pooldir string + pool AgentPoolData + agents map[string]*Agent + managers map[string]sse.Manager + agentStatus map[string]*Status + agentMemory map[string]*InMemoryDatabase + apiURL, model string + ragDB RAGDB + availableActions func(*AgentConfig) func(ctx context.Context) []Action + connectors func(*AgentConfig) []Connector + timeout string } type Status struct { - results []ActionState + ActionResults []ActionState } func (s *Status) addResult(result ActionState) { // If we have more than 10 results, remove the oldest one - if len(s.results) > 10 { - s.results = s.results[1:] + if len(s.ActionResults) > 10 { + s.ActionResults = s.ActionResults[1:] } - s.results = append(s.results, result) + s.ActionResults = append(s.ActionResults, result) } func (s *Status) Results() []ActionState { - return s.results + return s.ActionResults } type AgentPoolData map[string]AgentConfig @@ -59,7 +64,13 @@ func loadPoolFromFile(path string) (*AgentPoolData, error) { return poolData, err } -func NewAgentPool(model, apiURL, directory string, RagDB RAGDB) (*AgentPool, error) { +func NewAgentPool( + model, apiURL, directory string, + RagDB RAGDB, + availableActions func(*AgentConfig) func(ctx context.Context) []agent.Action, + connectors func(*AgentConfig) []Connector, + timeout string, +) (*AgentPool, error) { // if file exists, try to load an existing pool. // if file does not exist, create a new pool. @@ -68,16 +79,19 @@ func NewAgentPool(model, apiURL, directory string, RagDB RAGDB) (*AgentPool, err if _, err := os.Stat(poolfile); err != nil { // file does not exist, create a new pool return &AgentPool{ - file: poolfile, - pooldir: directory, - apiURL: apiURL, - model: model, - ragDB: RagDB, - agents: make(map[string]*Agent), - pool: make(map[string]AgentConfig), - agentStatus: make(map[string]*Status), - managers: make(map[string]Manager), - agentMemory: make(map[string]*InMemoryDatabase), + file: poolfile, + pooldir: directory, + apiURL: apiURL, + model: model, + ragDB: RagDB, + agents: make(map[string]*Agent), + pool: make(map[string]AgentConfig), + agentStatus: make(map[string]*Status), + managers: make(map[string]sse.Manager), + agentMemory: make(map[string]*InMemoryDatabase), + connectors: connectors, + availableActions: availableActions, + timeout: timeout, }, nil } @@ -86,16 +100,19 @@ func NewAgentPool(model, apiURL, directory string, RagDB RAGDB) (*AgentPool, err return nil, err } return &AgentPool{ - file: poolfile, - apiURL: apiURL, - pooldir: directory, - ragDB: RagDB, - model: model, - agents: make(map[string]*Agent), - managers: make(map[string]Manager), - agentStatus: map[string]*Status{}, - agentMemory: map[string]*InMemoryDatabase{}, - pool: *poolData, + file: poolfile, + apiURL: apiURL, + pooldir: directory, + ragDB: RagDB, + model: model, + agents: make(map[string]*Agent), + managers: make(map[string]sse.Manager), + agentStatus: map[string]*Status{}, + agentMemory: map[string]*InMemoryDatabase{}, + pool: *poolData, + connectors: connectors, + availableActions: availableActions, + timeout: timeout, }, nil } @@ -133,7 +150,7 @@ func (a *AgentPool) GetStatusHistory(name string) *Status { } func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error { - manager := NewManager(5) + manager := sse.NewManager(5) ctx := context.Background() model := a.model if config.Model != "" { @@ -143,9 +160,9 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error config.PeriodicRuns = "10m" } - connectors := config.availableConnectors() + connectors := a.connectors(config) - actions := config.availableActions(ctx) + actions := a.availableActions(config)(ctx) stateFile, characterFile, knowledgeBase := a.stateFiles(name) @@ -180,7 +197,7 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error WithContext(ctx), WithPeriodicRuns(config.PeriodicRuns), WithPermanentGoal(config.PermanentGoal), - WithCharacter(agent.Character{ + WithCharacter(Character{ Name: name, }), WithActions( @@ -188,7 +205,7 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error ), WithStateFile(stateFile), WithCharacterFile(characterFile), - WithTimeout(timeout), + WithTimeout(a.timeout), WithRAGDB(agentDB), WithAgentReasoningCallback(func(state ActionCurrentState) bool { xlog.Info( @@ -200,8 +217,8 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error ) manager.Send( - NewMessage( - fmt.Sprintf(`Thinking: %s`, htmlIfy(state.Reasoning)), + sse.NewMessage( + fmt.Sprintf(`Thinking: %s`, utils.HTMLify(state.Reasoning)), ).WithEvent("status"), ) @@ -239,8 +256,8 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error state.ActionCurrentState.Params, state.Result) manager.Send( - NewMessage( - htmlIfy( + sse.NewMessage( + utils.HTMLify( text, ), ).WithEvent("status"), @@ -315,8 +332,8 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error go func() { for { time.Sleep(1 * time.Second) // Send a message every seconds - manager.Send(NewMessage( - htmlIfy(agent.State().String()), + manager.Send(sse.NewMessage( + utils.HTMLify(agent.State().String()), ).WithEvent("hud")) } }() @@ -415,6 +432,6 @@ func (a *AgentPool) GetConfig(name string) *AgentConfig { return &agent } -func (a *AgentPool) GetManager(name string) Manager { +func (a *AgentPool) GetManager(name string) sse.Manager { return a.managers[name] } diff --git a/example/webui/actions.go b/example/webui/actions.go index b7136c7..c199ca4 100644 --- a/example/webui/actions.go +++ b/example/webui/actions.go @@ -5,9 +5,10 @@ import ( "encoding/json" "github.com/mudler/local-agent-framework/core/action" + "github.com/mudler/local-agent-framework/core/state" "github.com/mudler/local-agent-framework/pkg/xlog" - . "github.com/mudler/local-agent-framework/core/agent" + "github.com/mudler/local-agent-framework/core/agent" "github.com/mudler/local-agent-framework/services/actions" ) @@ -38,44 +39,46 @@ var AvailableActions = []string{ ActionSendMail, } -func (a *AgentConfig) availableActions(ctx context.Context) []Action { - allActions := []Action{} +func Actions(a *state.AgentConfig) func(ctx context.Context) []agent.Action { + return func(ctx context.Context) []agent.Action { + allActions := []agent.Action{} - for _, a := range a.Actions { - var config map[string]string - if err := json.Unmarshal([]byte(a.Config), &config); err != nil { - xlog.Error("Error unmarshalling action config", "error", err) - continue - } - - switch a.Name { - case ActionCustom: - customAction, err := action.NewCustom(config, "") - if err != nil { - xlog.Error("Error creating custom action", "error", err) + for _, a := range a.Actions { + var config map[string]string + if err := json.Unmarshal([]byte(a.Config), &config); err != nil { + xlog.Error("Error unmarshalling action config", "error", err) continue } - allActions = append(allActions, customAction) - case ActionSearch: - allActions = append(allActions, actions.NewSearch(config)) - case ActionGithubIssueLabeler: - allActions = append(allActions, actions.NewGithubIssueLabeler(ctx, config)) - case ActionGithubIssueOpener: - allActions = append(allActions, actions.NewGithubIssueOpener(ctx, config)) - case ActionGithubIssueCloser: - allActions = append(allActions, actions.NewGithubIssueCloser(ctx, config)) - case ActionGithubIssueSearcher: - allActions = append(allActions, actions.NewGithubIssueSearch(ctx, config)) - case ActionScraper: - allActions = append(allActions, actions.NewScraper(config)) - case ActionWikipedia: - allActions = append(allActions, actions.NewWikipedia(config)) - case ActionBrowse: - allActions = append(allActions, actions.NewBrowse(config)) - case ActionSendMail: - allActions = append(allActions, actions.NewSendMail(config)) - } - } - return allActions + switch a.Name { + case ActionCustom: + customAction, err := action.NewCustom(config, "") + if err != nil { + xlog.Error("Error creating custom action", "error", err) + continue + } + allActions = append(allActions, customAction) + case ActionSearch: + allActions = append(allActions, actions.NewSearch(config)) + case ActionGithubIssueLabeler: + allActions = append(allActions, actions.NewGithubIssueLabeler(ctx, config)) + case ActionGithubIssueOpener: + allActions = append(allActions, actions.NewGithubIssueOpener(ctx, config)) + case ActionGithubIssueCloser: + allActions = append(allActions, actions.NewGithubIssueCloser(ctx, config)) + case ActionGithubIssueSearcher: + allActions = append(allActions, actions.NewGithubIssueSearch(ctx, config)) + case ActionScraper: + allActions = append(allActions, actions.NewScraper(config)) + case ActionWikipedia: + allActions = append(allActions, actions.NewWikipedia(config)) + case ActionBrowse: + allActions = append(allActions, actions.NewBrowse(config)) + case ActionSendMail: + allActions = append(allActions, actions.NewSendMail(config)) + } + } + + return allActions + } } diff --git a/example/webui/app.go b/example/webui/app.go index bcc4673..6af4567 100644 --- a/example/webui/app.go +++ b/example/webui/app.go @@ -10,7 +10,9 @@ import ( "github.com/mudler/local-agent-framework/pkg/xlog" - . "github.com/mudler/local-agent-framework/core/agent" + "github.com/mudler/local-agent-framework/core/agent" + "github.com/mudler/local-agent-framework/core/sse" + "github.com/mudler/local-agent-framework/core/state" "github.com/donseba/go-htmx" "github.com/dslipak/pdf" @@ -20,11 +22,11 @@ import ( type ( App struct { htmx *htmx.HTMX - pool *AgentPool + pool *state.AgentPool } ) -func (a *App) KnowledgeBaseReset(pool *AgentPool) func(c *fiber.Ctx) error { +func (a *App) KnowledgeBaseReset(pool *state.AgentPool) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { db := pool.GetAgentMemory(c.Params("name")) db.Reset() @@ -32,7 +34,7 @@ func (a *App) KnowledgeBaseReset(pool *AgentPool) func(c *fiber.Ctx) error { } } -func (a *App) KnowledgeBaseExport(pool *AgentPool) func(c *fiber.Ctx) error { +func (a *App) KnowledgeBaseExport(pool *state.AgentPool) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { db := pool.GetAgentMemory(c.Params("name")) knowledgeBase := db.Data() @@ -42,7 +44,7 @@ func (a *App) KnowledgeBaseExport(pool *AgentPool) func(c *fiber.Ctx) error { } } -func (a *App) KnowledgeBaseImport(pool *AgentPool) func(c *fiber.Ctx) error { +func (a *App) KnowledgeBaseImport(pool *state.AgentPool) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { file, err := c.FormFile("file") if err != nil { @@ -85,7 +87,7 @@ func (a *App) KnowledgeBaseImport(pool *AgentPool) func(c *fiber.Ctx) error { } } -func (a *App) KnowledgeBaseFile(pool *AgentPool) func(c *fiber.Ctx) error { +func (a *App) KnowledgeBaseFile(pool *state.AgentPool) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { agent := pool.GetAgent(c.Params("name")) db := agent.Memory() @@ -127,7 +129,7 @@ func (a *App) KnowledgeBaseFile(pool *AgentPool) func(c *fiber.Ctx) error { chunkSize = payload.ChunkSize } - go StringsToKB(db, chunkSize, content) + go state.StringsToKB(db, chunkSize, content) _, err = c.WriteString(chatDiv("File uploaded", "gray")) @@ -135,7 +137,7 @@ func (a *App) KnowledgeBaseFile(pool *AgentPool) func(c *fiber.Ctx) error { } } -func (a *App) KnowledgeBase(pool *AgentPool) func(c *fiber.Ctx) error { +func (a *App) KnowledgeBase(pool *state.AgentPool) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { agent := pool.GetAgent(c.Params("name")) db := agent.Memory() @@ -158,13 +160,13 @@ func (a *App) KnowledgeBase(pool *AgentPool) func(c *fiber.Ctx) error { chunkSize = payload.ChunkSize } - go WebsiteToKB(website, chunkSize, db) + go state.WebsiteToKB(website, chunkSize, db) return c.Redirect("/knowledgebase/" + c.Params("name")) } } -func (a *App) Notify(pool *AgentPool) func(c *fiber.Ctx) error { +func (a *App) Notify(pool *state.AgentPool) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { payload := struct { Message string `form:"message"` @@ -180,9 +182,9 @@ func (a *App) Notify(pool *AgentPool) func(c *fiber.Ctx) error { return nil } - agent := pool.GetAgent(c.Params("name")) - agent.Ask( - WithText(query), + a := pool.GetAgent(c.Params("name")) + a.Ask( + agent.WithText(query), ) _, _ = c.Write([]byte("Message sent")) @@ -190,7 +192,7 @@ func (a *App) Notify(pool *AgentPool) func(c *fiber.Ctx) error { } } -func (a *App) Delete(pool *AgentPool) func(c *fiber.Ctx) error { +func (a *App) Delete(pool *state.AgentPool) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { if err := pool.Remove(c.Params("name")); err != nil { xlog.Info("Error removing agent", err) @@ -200,7 +202,7 @@ func (a *App) Delete(pool *AgentPool) func(c *fiber.Ctx) error { } } -func (a *App) Pause(pool *AgentPool) func(c *fiber.Ctx) error { +func (a *App) Pause(pool *state.AgentPool) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { xlog.Info("Pausing agent", c.Params("name")) agent := pool.GetAgent(c.Params("name")) @@ -211,7 +213,7 @@ func (a *App) Pause(pool *AgentPool) func(c *fiber.Ctx) error { } } -func (a *App) Start(pool *AgentPool) func(c *fiber.Ctx) error { +func (a *App) Start(pool *state.AgentPool) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { agent := pool.GetAgent(c.Params("name")) if agent != nil { @@ -221,9 +223,9 @@ func (a *App) Start(pool *AgentPool) func(c *fiber.Ctx) error { } } -func (a *App) Create(pool *AgentPool) func(c *fiber.Ctx) error { +func (a *App) Create(pool *state.AgentPool) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { - config := AgentConfig{} + config := state.AgentConfig{} if err := c.BodyParser(&config); err != nil { return err } @@ -242,7 +244,7 @@ func (a *App) Create(pool *AgentPool) func(c *fiber.Ctx) error { } } -func (a *App) ExportAgent(pool *AgentPool) func(c *fiber.Ctx) error { +func (a *App) ExportAgent(pool *state.AgentPool) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { agent := pool.GetConfig(c.Params("name")) if agent == nil { @@ -254,7 +256,7 @@ func (a *App) ExportAgent(pool *AgentPool) func(c *fiber.Ctx) error { } } -func (a *App) ImportAgent(pool *AgentPool) func(c *fiber.Ctx) error { +func (a *App) ImportAgent(pool *state.AgentPool) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { file, err := c.FormFile("file") if err != nil { @@ -275,7 +277,7 @@ func (a *App) ImportAgent(pool *AgentPool) func(c *fiber.Ctx) error { return err } - config := AgentConfig{} + config := state.AgentConfig{} if err := json.Unmarshal(data, &config); err != nil { return err } @@ -295,7 +297,7 @@ func (a *App) ImportAgent(pool *AgentPool) func(c *fiber.Ctx) error { } } -func (a *App) Chat(pool *AgentPool) func(c *fiber.Ctx) error { +func (a *App) Chat(pool *state.AgentPool) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { payload := struct { Message string `json:"message"` @@ -313,18 +315,18 @@ func (a *App) Chat(pool *AgentPool) func(c *fiber.Ctx) error { return nil } manager.Send( - NewMessage( + sse.NewMessage( chatDiv(query, "gray"), ).WithEvent("messages")) go func() { - agent := pool.GetAgent(agentName) - if agent == nil { + a := pool.GetAgent(agentName) + if a == nil { xlog.Info("Agent not found in pool", c.Params("name")) return } - res := agent.Ask( - WithText(query), + res := a.Ask( + agent.WithText(query), ) if res.Error != nil { xlog.Error("Error asking agent", "agent", agentName, "error", res.Error) @@ -332,11 +334,11 @@ func (a *App) Chat(pool *AgentPool) func(c *fiber.Ctx) error { xlog.Info("we got a response from the agent", "agent", agentName, "response", res.Response) } manager.Send( - NewMessage( + sse.NewMessage( chatDiv(res.Response, "blue"), ).WithEvent("messages")) manager.Send( - NewMessage( + sse.NewMessage( disabledElement("inputMessage", false), // show again the input ).WithEvent("message_status")) @@ -345,7 +347,7 @@ func (a *App) Chat(pool *AgentPool) func(c *fiber.Ctx) error { }() manager.Send( - NewMessage( + sse.NewMessage( loader() + disabledElement("inputMessage", true), ).WithEvent("message_status")) diff --git a/example/webui/connectors.go b/example/webui/connectors.go index 2e54fda..fcf7fc5 100644 --- a/example/webui/connectors.go +++ b/example/webui/connectors.go @@ -6,7 +6,7 @@ import ( "github.com/mudler/local-agent-framework/pkg/xlog" "github.com/mudler/local-agent-framework/services/connectors" - . "github.com/mudler/local-agent-framework/core/agent" + "github.com/mudler/local-agent-framework/core/state" ) const ( @@ -18,12 +18,6 @@ const ( ConnectorGithubPRs = "github-prs" ) -type Connector interface { - AgentResultCallback() func(state ActionState) - AgentReasoningCallback() func(state ActionCurrentState) bool - Start(a *Agent) -} - var AvailableConnectors = []string{ ConnectorTelegram, ConnectorSlack, @@ -32,8 +26,8 @@ var AvailableConnectors = []string{ ConnectorGithubPRs, } -func (a *AgentConfig) availableConnectors() []Connector { - conns := []Connector{} +func Connectors(a *state.AgentConfig) []state.Connector { + conns := []state.Connector{} for _, c := range a.Connector { var config map[string]string diff --git a/example/webui/main.go b/example/webui/main.go index b24a88f..8a3d2cb 100644 --- a/example/webui/main.go +++ b/example/webui/main.go @@ -10,9 +10,10 @@ import ( fiber "github.com/gofiber/fiber/v2" "github.com/gofiber/template/html/v2" - . "github.com/mudler/local-agent-framework/core/agent" + "github.com/mudler/local-agent-framework/core/agent" + "github.com/mudler/local-agent-framework/core/state" "github.com/mudler/local-agent-framework/pkg/llm" - "github.com/mudler/local-agent-framework/pkg/llm/rag" + rag "github.com/mudler/local-agent-framework/pkg/vectorstore" ) var testModel = os.Getenv("TEST_MODEL") @@ -52,7 +53,7 @@ func main() { stateDir := cwd + "/pool" os.MkdirAll(stateDir, 0755) - var ragDB RAGDB + var ragDB agent.RAGDB lai := llm.NewClient(apiKey, apiURL+"/v1", timeout) switch vectorStore { @@ -67,7 +68,7 @@ func main() { } } - pool, err := NewAgentPool(testModel, apiURL, stateDir, ragDB) + pool, err := state.NewAgentPool(testModel, apiURL, stateDir, ragDB, Actions, Connectors, timeout) if err != nil { panic(err) } diff --git a/example/webui/routes.go b/example/webui/routes.go index afe052f..24646a1 100644 --- a/example/webui/routes.go +++ b/example/webui/routes.go @@ -7,9 +7,11 @@ import ( fiber "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/filesystem" "github.com/mudler/local-agent-framework/core/agent" + "github.com/mudler/local-agent-framework/core/sse" + "github.com/mudler/local-agent-framework/core/state" ) -func RegisterRoutes(webapp *fiber.App, pool *AgentPool, app *App) { +func RegisterRoutes(webapp *fiber.App, pool *state.AgentPool, app *App) { webapp.Use("/public", filesystem.New(filesystem.Config{ Root: http.FS(embeddedFiles), @@ -59,14 +61,14 @@ func RegisterRoutes(webapp *fiber.App, pool *AgentPool, app *App) { return c.SendStatus(404) } - m.Handle(c, NewClient(randStringRunes(10))) + m.Handle(c, sse.NewClient(randStringRunes(10))) return nil }) webapp.Get("/status/:name", func(c *fiber.Ctx) error { history := pool.GetStatusHistory(c.Params("name")) if history == nil { - history = &Status{results: []agent.ActionState{}} + history = &state.Status{ActionResults: []agent.ActionState{}} } // reverse history diff --git a/pkg/utils/html.go b/pkg/utils/html.go new file mode 100644 index 0000000..7ce3943 --- /dev/null +++ b/pkg/utils/html.go @@ -0,0 +1,9 @@ +package utils + +import "strings" + +func HTMLify(s string) string { + s = strings.TrimSpace(s) + s = strings.ReplaceAll(s, "\n", "
") + return s +} diff --git a/pkg/llm/rag/chromem.go b/pkg/vectorstore/chromem.go similarity index 99% rename from pkg/llm/rag/chromem.go rename to pkg/vectorstore/chromem.go index 3d0ca6f..4770eb6 100644 --- a/pkg/llm/rag/chromem.go +++ b/pkg/vectorstore/chromem.go @@ -1,4 +1,4 @@ -package rag +package vectorstore import ( "context" diff --git a/pkg/llm/rag/localai.go b/pkg/vectorstore/localai.go similarity index 98% rename from pkg/llm/rag/localai.go rename to pkg/vectorstore/localai.go index 37a8fa4..b8fca71 100644 --- a/pkg/llm/rag/localai.go +++ b/pkg/vectorstore/localai.go @@ -1,4 +1,4 @@ -package rag +package vectorstore import ( "context" diff --git a/pkg/llm/rag/store.go b/pkg/vectorstore/store.go similarity index 99% rename from pkg/llm/rag/store.go rename to pkg/vectorstore/store.go index 1980cf9..820ac5a 100644 --- a/pkg/llm/rag/store.go +++ b/pkg/vectorstore/store.go @@ -1,4 +1,4 @@ -package rag +package vectorstore import ( "bytes"