diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f6d82df..6b49966 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,26 +12,30 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 - - name: Restore cached cookies - id: cache-cookies-restore - uses: actions/cache/restore@v4 + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 with: - path: | - cookies - key: ${{ runner.os }}-cookies + go-version: '1.24' + - name: Create .env file from secrets + run: | + cat > .env << EOF + OPENAI_TOKEN=${{ secrets.OPENAI_TOKEN }} + GOPHER_CLIENT_TOKEN=${{ secrets.GOPHER_CLIENT_TOKEN }} + GOPHER_CLIENT_URL=${{ secrets.GOPHER_CLIENT_URL }} + GOPHER_CLIENT_TIMEOUT=${{ secrets.GOPHER_CLIENT_TIMEOUT }} + EOF - name: Run tests run: make test ready-to-merge: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 + runs-on: ubuntu-latest - - name: Verify that merging is OK - run: | - if grep -rE 'DO[ ]NOT[ ]MERGE|[ ]FIXME' .; then - exit 1 - fi + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Verify that merging is OK + run: | + if grep -rE 'DO[ ]NOT[ ]MERGE|[ ]FIXME' .; then + exit 1 + fi diff --git a/Makefile b/Makefile index 388aa5c..5fb4cde 100644 --- a/Makefile +++ b/Makefile @@ -82,12 +82,6 @@ test-verbose: deps ## Run tests with verbose output @mkdir -p $(COVERAGE_DIR) @$(GOTEST) $(TEST_FLAGS) $(TEST_ARGS) -.PHONY: test-agent -test-agent: deps ## Run only agent package tests (lightweight) - @echo "Running agent package tests..." - @mkdir -p $(COVERAGE_DIR) - @$(GOTEST) -v -count=1 -p=1 -coverprofile=$(COVERAGE_DIR)/coverage.txt -covermode=atomic ./agent - .PHONY: coverage coverage: test ## Generate and display coverage report @echo "Generating coverage report..." diff --git a/agent/agent.go b/agent/agent.go deleted file mode 100644 index f90e51f..0000000 --- a/agent/agent.go +++ /dev/null @@ -1,119 +0,0 @@ -package agent - -import ( - "context" - "errors" - "time" - - "github.com/mudler/cogito" - "github.com/mudler/cogito/structures" - "github.com/sashabaranov/go-openai/jsonschema" - - "github.com/gopher-lab/gopher-client/client" - "github.com/gopher-lab/gopher-client/config" - "github.com/gopher-lab/gopher-client/types" -) - -type Agent struct { - llm cogito.LLM - c *client.Client -} - -var ( - ErrOpenAITokenRequired = errors.New("must supply an OPENAI_TOKEN") -) - -const ( - DefaultModel = "gpt-5-nano" - DefaultOpenAIApiUrl = "https://api.openai.com/v1" - DefaultPromptSuffix = "If no date range is specified, search the last 7 days." -) - -// New creates a new Agent with the provided OpenAI token and model. Model defaults to gpt-5-nano. -func New(c *client.Client, openAIToken string) (*Agent, error) { - if openAIToken == "" { - return nil, ErrOpenAITokenRequired - } - llm := cogito.NewOpenAILLM(DefaultModel, openAIToken, DefaultOpenAIApiUrl) - return &Agent{llm: llm, c: c}, nil -} - -// NewFromConfig creates a new Agent from config, defaulting the model to gpt-5-nano. -func NewFromConfig(c *client.Client) (*Agent, error) { - cfg, err := config.LoadConfig() - if err != nil { - return nil, err - } - return New(c, cfg.OpenAIToken) -} - -// Query runs the agent with the provided natural language instruction. -// It uses Cogito with the TwitterSearch tool and extracts a structured Output. -func (a *Agent) Query(ctx context.Context, query string) (*types.Output, error) { - // Include instruction supplement: operators/help and default date guidance - fullPrompt := query + "\n\n" + TwitterQueryInstructions + "\n\n" + DefaultPromptSuffix - - fragment := cogito.NewEmptyFragment(). - AddMessage("user", fullPrompt) - - improved, err := cogito.ContentReview( - a.llm, - fragment, - // cogito.EnableDeepContext, - // cogito.EnableToolReEvaluator, - // cogito.EnableToolReasoner, - cogito.WithIterations(1), - cogito.WithMaxAttempts(1), - cogito.WithTools(&TwitterSearch{Client: a.c}), - ) - if err != nil { - return nil, err - } - - // Ask the model to return only JSON for topics with sentiments and influencers - result, err := a.llm.Ask(ctx, improved.AddMessage("user", "Return now only a JSON object with fields: topics (ordered by most relevant, each with topic, sentiment as bullish/bearish/neutral, and top_influencers array).")) - if err != nil { - return nil, err - } - - out := &types.Output{} - - // Define schema for structured extraction - schema := jsonschema.Definition{ - Type: jsonschema.Object, - AdditionalProperties: false, - Properties: map[string]jsonschema.Definition{ - "topics": { - Type: jsonschema.Array, - Description: "Trending topics with sentiment and influencers", - Items: &jsonschema.Definition{ - Type: jsonschema.Object, - AdditionalProperties: false, - Properties: map[string]jsonschema.Definition{ - "topic": {Type: jsonschema.String}, - "sentiment": {Type: jsonschema.String, Description: "bullish, bearish, or neutral"}, - "top_influencers": {Type: jsonschema.Array, Items: &jsonschema.Definition{Type: jsonschema.String}}, - }, - Required: []string{"topic", "sentiment", "top_influencers"}, - }, - }, - }, - Required: []string{"topics"}, - } - - s := structures.Structure{ - Schema: schema, - Object: out, - } - - // Provide a timeout context for extraction - ctxExtract, cancel := context.WithTimeout(ctx, 2*time.Minute) - defer cancel() - - if err := result.ExtractStructure(ctxExtract, a.llm, s); err != nil { - // If extraction fails, still return empty Output to avoid nil - // no-op - } - - return out, nil -} diff --git a/agent/agent_suite_test.go b/agent/agent_suite_test.go deleted file mode 100644 index 736071d..0000000 --- a/agent/agent_suite_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package agent_test - -import ( - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -func TestAgent(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Agent Suite") -} diff --git a/agent/agent_test.go b/agent/agent_test.go deleted file mode 100644 index 8d12371..0000000 --- a/agent/agent_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package agent_test - -import ( - "context" - "encoding/json" - "fmt" - "time" - - "github.com/gopher-lab/gopher-client/agent" - "github.com/gopher-lab/gopher-client/client" - "github.com/gopher-lab/gopher-client/config" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -func prettyPrint(v any) string { - b, _ := json.MarshalIndent(v, "", " ") - return string(b) -} - -var _ = Describe("Agent integration", func() { - It("creates client+agent from config and answers a query", func() { - cfg := config.MustLoadConfig() - if cfg.OpenAIToken == "" { - Skip("OPENAI_TOKEN not set; skipping agent integration test") - } - - c, err := client.NewClientFromConfig() - Expect(err).ToNot(HaveOccurred()) - - ag, err := agent.NewFromConfig(c) - Expect(err).ToNot(HaveOccurred()) - - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute) - defer cancel() - - query := "You have to find out a list of the most trending topics related to crypto and altcoins worldwide on Twitter for the last 3 days. Use the search_twitter tool." - out, err := ag.Query(ctx, query) - Expect(err).ToNot(HaveOccurred()) - Expect(out).ToNot(BeNil()) - - fmt.Println(prettyPrint(out)) - }) -}) diff --git a/agent/twitter.go b/agent/twitter.go deleted file mode 100644 index 7e4b597..0000000 --- a/agent/twitter.go +++ /dev/null @@ -1,109 +0,0 @@ -package agent - -import ( - "encoding/json" - - "github.com/gopher-lab/gopher-client/client" - "github.com/masa-finance/tee-worker/v2/api/args/twitter" - openai "github.com/sashabaranov/go-openai" - "github.com/sashabaranov/go-openai/jsonschema" -) - -// TwitterQueryInstructions contains long-form guidance and examples for constructing Twitter queries. -// If no date range is specified by the user, searches should consider the last 7 days. -const TwitterQueryInstructions = ` -watching now containing both "watching" and "now". This is the default operator. -"happy hour" containing the exact phrase "happy hour". -love OR hate containing either "love" or "hate" (or both). -beer -root containing "beer" but not "root". -#haiku containing the hashtag "haiku". -from:interior sent from Twitter account "interior". -list:NASA/astronauts-in-space-now sent from a Twitter account in the NASA list astronauts-in-space-now -to:NASA a Tweet authored in reply to Twitter account "NASA". -@NASA mentioning Twitter account "NASA". -puppy filter:media containing "puppy" and an image or video. -puppy -filter:retweets containing "puppy", filtering out retweets -puppy filter:native_video containing "puppy" and an uploaded video, Amplify video, Periscope, or Vine. -puppy filter:periscope containing "puppy" and a Periscope video URL. -puppy filter:vine containing "puppy" and a Vine. -puppy filter:images containing "puppy" and links identified as photos, including third parties such as Instagram. -puppy filter:twimg containing "puppy" and a pic.twitter.com link representing one or more photos. -hilarious filter:links containing "hilarious" and linking to URL. -puppy url:amazon containing "puppy" and a URL with the word "amazon" anywhere within it. -superhero since:2015-12-21 containing "superhero" and sent since date "2015-12-21" (year-month-day). -puppy until:2015-12-21 containing "puppy" and sent before the date "2015-12-21". -movie -scary :) containing "movie", but not "scary", and with a positive attitude. -flight :( containing "flight" and with a negative attitude. -traffic ? containing "traffic" and asking a question. - -Example: - -altcoin or bitcoin :) - -To search for the same day, you must subtract a day between since and until: -altcoin or bitcoin :) since:2025-03-23 until:2025-03-24 - -If no date range is specified, default to the last 7 days. -` - -// TwitterSearch is a Cogito tool that bridges to the client's SearchTwitterWithArgs -type TwitterSearch struct { - Client *client.Client -} - -func (t *TwitterSearch) Name() string { - return "search_twitter" -} - -func (t *TwitterSearch) Description() string { - return "Search Twitter using the provided query. Include operators, since/until. Defaults to last 7 days if none provided." -} - -// Tool describes the tool for the underlying LLM provider (OpenAI-compatible) -func (t *TwitterSearch) Tool() openai.Tool { - return openai.Tool{ - Type: openai.ToolTypeFunction, - Function: &openai.FunctionDefinition{ - Name: t.Name(), - Description: t.Description(), - Parameters: jsonschema.Definition{ - Type: jsonschema.Object, - Properties: map[string]jsonschema.Definition{ - "query": {Type: jsonschema.String, Description: "Twitter advanced search query (with operators, since/until)"}, - }, - Required: []string{"query"}, - }, - }, - } -} - -// Run executes the tool. Signature follows Cogito's Tool interface expectations. -// Expects params to include either {"query": "..."} or raw query under a heuristic. -func (t *TwitterSearch) Run(params map[string]any) (string, error) { - var query string - if q, ok := params["query"].(string); ok { - query = q - } else if q, ok := params["input"].(string); ok { - query = q - } else { - b, _ := json.Marshal(params) - query = string(b) - } - - args := twitter.NewSearchArguments() - args.Query = query - - docs, err := t.Client.SearchTwitterWithArgs(args) - if err != nil { - return "", err - } - - // Extract only the content field from documents - contents := make([]string, 0, len(docs)) - for _, d := range docs { - contents = append(contents, d.Content) - } - - b, _ := json.Marshal(contents) - return string(b), nil -} diff --git a/config/config.go b/config/config.go index 5a486a6..fd2da62 100644 --- a/config/config.go +++ b/config/config.go @@ -13,10 +13,9 @@ import ( ) type Config struct { - BaseUrl string `envconfig:"GOPHER_CLIENT_URL" default:"https://data.gopher-ai.com/api"` - Timeout time.Duration `envconfig:"GOPHER_CLIENT_TIMEOUT" default:"60s"` - Token string `envconfig:"GOPHER_CLIENT_TOKEN"` - OpenAIToken string `envconfig:"OPENAI_TOKEN"` + BaseUrl string `envconfig:"GOPHER_CLIENT_URL" default:"https://data.gopher-ai.com/api"` + Timeout time.Duration `envconfig:"GOPHER_CLIENT_TIMEOUT" default:"60s"` + Token string `envconfig:"GOPHER_CLIENT_TOKEN"` } // LoadConfig loads the Config from environment variables. diff --git a/config/config_test.go b/config/config_test.go index 1a5b42f..270dc98 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -27,10 +27,6 @@ var _ = Describe("Config", func() { Equal("https://data.gopher-ai.com/api"), // default Equal("https://gopher-data.dev.masalabs.ai/api"), // dev from .env )) - Expect(cfg.Token).To(SatisfyAny( - Equal(""), // default - Equal("rv53jbsoZieW4jOUdArHPmYGxlOiz4UvTyZv2h5bkbSjTU7J"), // dev from .env - )) }) }) diff --git a/go.mod b/go.mod index 55cc413..0a4d065 100644 --- a/go.mod +++ b/go.mod @@ -6,34 +6,21 @@ require ( github.com/joho/godotenv v1.5.1 github.com/kelseyhightower/envconfig v1.4.0 github.com/masa-finance/tee-worker/v2 v2.0.1 - github.com/mudler/cogito v0.3.3 github.com/onsi/ginkgo/v2 v2.26.0 github.com/onsi/gomega v1.38.2 - github.com/sashabaranov/go-openai v1.41.2 ) require ( - dario.cat/mergo v1.0.1 // indirect - github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.4.0 // indirect - github.com/Masterminds/sprig/v3 v3.3.0 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/go-cmp v0.7.0 // indirect - github.com/google/jsonschema-go v0.3.0 // indirect github.com/google/pprof v0.0.0-20251007162407-5df77e3f7d1d // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/huandu/xstrings v1.5.0 // indirect - github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/mitchellh/reflectwalk v1.0.2 // indirect - github.com/modelcontextprotocol/go-sdk v1.0.0 // indirect - github.com/shopspring/decimal v1.4.0 // indirect - github.com/spf13/cast v1.7.0 // indirect - github.com/tmc/langchaingo v0.1.13 // indirect - github.com/yosida95/uritemplate/v3 v3.0.2 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/stretchr/testify v1.11.1 // indirect go.uber.org/automaxprocs v1.6.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/crypto v0.43.0 // indirect golang.org/x/exp v0.0.0-20251002181428-27f1f14c8bb9 // indirect golang.org/x/mod v0.28.0 // indirect golang.org/x/net v0.46.0 // indirect diff --git a/go.sum b/go.sum index 3b821fd..d228434 100644 --- a/go.sum +++ b/go.sum @@ -1,44 +1,7 @@ -dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= -dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= -github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= -github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= -github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs= -github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= -github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= -github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= -github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= -github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE= -github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk= -github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= -github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= -github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= -github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw= -github.com/cpuguy83/dockercfg v0.3.2 h1:DlJTyZGBDlXqUZ2Dk2Q3xHs/FtnooJJVaad2S9GKorA= -github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= -github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/docker v28.2.2+incompatible h1:CjwRSksz8Yo4+RmQ339Dp/D2tGO5JxwYeqtMOEe0LDw= -github.com/docker/docker v28.2.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= -github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= -github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= -github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw= -github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= -github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= -github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= -github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/gkampitakis/ciinfo v0.3.2 h1:JcuOPk8ZU7nZQjdUhctuhQofk7BGHuIy0c9Ez8BNhXs= github.com/gkampitakis/ciinfo v0.3.2/go.mod h1:1NIwaOcFChN4fa/B0hEBdAb6npDlFL8Bwx4dfRLRqAo= github.com/gkampitakis/go-diff v1.3.2 h1:Qyn0J9XJSDTgnsgHRdz9Zp24RaJeKMUHg2+PDZZdC4M= @@ -47,104 +10,42 @@ github.com/gkampitakis/go-snaps v0.5.14 h1:3fAqdB6BCPKHDMHAKRwtPUwYexKtGrNuw8HX/ github.com/gkampitakis/go-snaps v0.5.14/go.mod h1:HNpx/9GoKisdhw9AFOBT1N7DBs9DiHo/hGheFGBZ+mc= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= -github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw= github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/jsonschema-go v0.3.0 h1:6AH2TxVNtk3IlvkkhjrtbUc4S8AvO0Xii0DxIygDg+Q= -github.com/google/jsonschema-go v0.3.0/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE= github.com/google/pprof v0.0.0-20251007162407-5df77e3f7d1d h1:KJIErDwbSHjnp/SGzE5ed8Aol7JsKiI5X7yWKAtzhM0= github.com/google/pprof v0.0.0-20251007162407-5df77e3f7d1d/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= -github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/joshdk/go-junit v1.0.0 h1:S86cUKIdwBHWwA6xCmFlf3RTLfVXYQfvanM5Uh+K6GE= github.com/joshdk/go-junit v1.0.0/go.mod h1:TiiV0PqkaNfFXjEiyjWM3XXrhVyCa1K4Zfga6W52ung= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= -github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= -github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= -github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= -github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= -github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/maruel/natural v1.1.1 h1:Hja7XhhmvEFhcByqDoHz9QZbkWey+COd9xWfCfn1ioo= github.com/maruel/natural v1.1.1/go.mod h1:v+Rfd79xlw1AgVBjbO0BEQmptqb5HvL/k9GRHB7ZKEg= github.com/masa-finance/tee-worker/v2 v2.0.1 h1:slBs/++SaNldV0vFL5IpAZSyKKd0HYPsyrr7FWFjPgg= github.com/masa-finance/tee-worker/v2 v2.0.1/go.mod h1:+xlwtrj+bQDSf4jsPlJAMPvqvYrGS3ItHG0J1WRXweY= github.com/mfridman/tparse v0.18.0 h1:wh6dzOKaIwkUGyKgOntDW4liXSo37qg5AXbIhkMV3vE= github.com/mfridman/tparse v0.18.0/go.mod h1:gEvqZTuCgEhPbYk/2lS3Kcxg1GmTxxU7kTC8DvP0i/A= -github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= -github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= -github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= -github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= -github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= -github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ= -github.com/moby/go-archive v0.1.0/go.mod h1:G9B+YoujNohJmrIYFBpSd54GTUB4lt9S+xVQvsJyFuo= -github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= -github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= -github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= -github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko= -github.com/moby/sys/user v0.4.0 h1:jhcMKit7SA80hivmFJcbB1vqmw//wU61Zdui2eQXuMs= -github.com/moby/sys/user v0.4.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= -github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= -github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= -github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= -github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= -github.com/modelcontextprotocol/go-sdk v1.0.0 h1:Z4MSjLi38bTgLrd/LjSmofqRqyBiVKRyQSJgw8q8V74= -github.com/modelcontextprotocol/go-sdk v1.0.0/go.mod h1:nYtYQroQ2KQiM0/SbyEPUWQ6xs4B95gJjEalc9AQyOs= -github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= -github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/mudler/cogito v0.3.3 h1:hs69DsNdbXHeB0heZhJpqi4JWjj4uW7kRmjhTw5KwUc= -github.com/mudler/cogito v0.3.3/go.mod h1:abMwl+CUjCp87IufA2quZdZt0bbLaHHN79o17HbUKxU= github.com/onsi/ginkgo/v2 v2.26.0 h1:1J4Wut1IlYZNEAWIV3ALrT9NfiaGW2cDCJQSFQMs/gE= github.com/onsi/ginkgo/v2 v2.26.0/go.mod h1:qhEywmzWTBUY88kfO0BRvX4py7scov9yR+Az2oavUzw= github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A= github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k= -github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= -github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= -github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= -github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= -github.com/sashabaranov/go-openai v1.41.2 h1:vfPRBZNMpnqu8ELsclWcAvF19lDNgh1t6TVfFFOPiSM= -github.com/sashabaranov/go-openai v1.41.2/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= -github.com/shirou/gopsutil/v4 v4.25.5 h1:rtd9piuSMGeU8g1RMXjZs9y9luK5BwtnG7dZaQUJAsc= -github.com/shirou/gopsutil/v4 v4.25.5/go.mod h1:PfybzyydfZcN+JMMjkF6Zb8Mq1A/VcogFFg7hj50W9c= -github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= -github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= -github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -github.com/testcontainers/testcontainers-go v0.38.0 h1:d7uEapLcv2P8AvH8ahLqDMMxda2W9gQN1nRbHS28HBw= -github.com/testcontainers/testcontainers-go v0.38.0/go.mod h1:C52c9MoHpWO+C4aqmgSU+hxlR5jlEayWtgYrb8Pzz1w= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= @@ -153,32 +54,10 @@ github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= -github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= -github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= -github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= -github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= -github.com/tmc/langchaingo v0.1.13 h1:rcpMWBIi2y3B90XxfE4Ao8dhCQPVDMaNPnN5cGB1CaA= -github.com/tmc/langchaingo v0.1.13/go.mod h1:vpQ5NOIhpzxDfTZK9B6tf2GM/MoaHewPWM5KXXGh7hg= -github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4= -github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4= -github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= -github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= -go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0 h1:Xs2Ncz0gNihqu9iosIZ5SkBbWo5T8JhhLJFMQL1qmLI= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0/go.mod h1:vy+2G/6NvVMpwGX/NyLqcC41fxepnuKHk16E6IZUcJc= -go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= -go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= -go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= -go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= -go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= -go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04= -golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0= golang.org/x/exp v0.0.0-20251002181428-27f1f14c8bb9 h1:TQwNpfvNkxAVlItJf6Cr5JTsVZoC/Sj7K3OZv2Pc14A= golang.org/x/exp v0.0.0-20251002181428-27f1f14c8bb9/go.mod h1:TwQYMMnGpvZyc+JpB/UAuTNIsVJifOlSkrZkhcvpVUk= golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U= diff --git a/types/agent.go b/types/agent.go deleted file mode 100644 index 55a047e..0000000 --- a/types/agent.go +++ /dev/null @@ -1,28 +0,0 @@ -package types - -import ( - "github.com/masa-finance/tee-worker/v2/api/types" -) - -type Sentiment string -type TopInfluencers []string -type Topic string - -const ( - SentimentBullish Sentiment = "bullish" - SentimentBearish Sentiment = "bearish" - SentimentNeutral Sentiment = "neutral" -) - -// TopicSummary represents a topic with sentiment and influencers discovered by the agent -type TopicSummary struct { - Topic Topic `json:"topic"` - Sentiment Sentiment `json:"sentiment"` - TopInfluencers TopInfluencers `json:"top_influencers"` -} - -// Output is the agent's structured output -type Output struct { - Topics []TopicSummary `json:"topics"` - Documents []types.Document `json:"documents,omitempty"` -}