From 89608991a06649580c49d189170eadcc62ae4d06 Mon Sep 17 00:00:00 2001 From: venjiang Date: Wed, 22 May 2024 22:23:52 +0800 Subject: [PATCH] refactor: serverless context (#822) # Description the serverless context supports LLM read and write operations, simplifying LLM function calls. --- README.md | 6 +- ai/function_call.go | 48 --- ai/function_call_test.go | 57 ++-- ai/mock_context.go | 143 +++++++++ cli/serverless/golang/templates/main.tmpl | 1 + core/serverless/context.go | 2 + core/serverless/context_llm.go | 50 +++ .../10-ai/llm-sfn-currency-converter/app.go | 12 +- .../10-ai/llm-sfn-currency-converter/go.mod | 16 + .../10-ai/llm-sfn-currency-converter/go.sum | 10 + .../10-ai/llm-sfn-get-ip-and-latency/app.go | 11 +- .../10-ai/llm-sfn-get-ip-and-latency/go.mod | 4 +- example/10-ai/llm-sfn-get-weather/app.go | 34 +-- example/10-ai/llm-sfn-get-weather/go.mod | 53 ++++ example/10-ai/llm-sfn-get-weather/go.sum | 288 ++++++++++++++++++ .../10-ai/llm-sfn-timezone-calculator/app.go | 12 +- .../10-ai/llm-sfn-timezone-calculator/go.mod | 7 + .../10-ai/llm-sfn-timezone-calculator/go.sum | 2 + pkg/bridge/ai/service.go | 3 +- serverless/context.go | 6 + serverless/guest/context_llm.go | 13 + serverless/mock/mock_context.go | 84 ----- 22 files changed, 637 insertions(+), 225 deletions(-) create mode 100644 ai/mock_context.go create mode 100644 core/serverless/context_llm.go create mode 100644 example/10-ai/llm-sfn-currency-converter/go.mod create mode 100644 example/10-ai/llm-sfn-currency-converter/go.sum create mode 100644 example/10-ai/llm-sfn-get-weather/go.mod create mode 100644 example/10-ai/llm-sfn-get-weather/go.sum create mode 100644 example/10-ai/llm-sfn-timezone-calculator/go.mod create mode 100644 example/10-ai/llm-sfn-timezone-calculator/go.sum create mode 100644 serverless/guest/context_llm.go delete mode 100644 serverless/mock/mock_context.go diff --git a/README.md b/README.md index 0133d4bb2..b6a6e9fd5 100644 --- a/README.md +++ b/README.md @@ -105,10 +105,8 @@ Create a Stateful Serverless Function to get the IP and Latency of a domain: ```golang func Handler(ctx serverless.Context) { - fc, _ := ai.ParseFunctionCallContext(ctx) - var msg Parameter - fc.UnmarshalArguments(&msg) + ctx.ReadLLMArguments(&msg) // get ip of the domain ips, _ := net.LookupIP(msg.Domain) @@ -120,7 +118,7 @@ func Handler(ctx serverless.Context) { stats := pinger.Statistics() val := fmt.Sprintf("domain %s has ip %s with average latency %s", msg.Domain, ips[0], stats.AvgRtt) - fc.Write(val) + ctx.WriteLLMResult(val) } ``` diff --git a/ai/function_call.go b/ai/function_call.go index 694eed33c..1772495e1 100644 --- a/ai/function_call.go +++ b/ai/function_call.go @@ -2,7 +2,6 @@ package ai import ( "encoding/json" - "fmt" "github.com/yomorun/yomo/serverless" ) @@ -58,50 +57,3 @@ func (fco *FunctionCall) FromBytes(b []byte) error { fco.IsOK = obj.IsOK return nil } - -// Write writes the result to zipper -func (fco *FunctionCall) Write(result string) error { - fco.Result = result - fco.IsOK = true - buf, err := fco.Bytes() - if err != nil { - return err - } - return fco.ctx.Write(ReducerTag, buf) -} - -// WriteErrors writes the error to reducer -func (fco *FunctionCall) WriteErrors(err error) error { - fco.IsOK = false - fco.Error = err.Error() - return fco.Write("") -} - -// UnmarshalArguments deserialize Arguments to the parameter object -func (fco *FunctionCall) UnmarshalArguments(v any) error { - return json.Unmarshal([]byte(fco.Arguments), v) -} - -// JSONString returns the JSON string of FunctionCallObject -func (fco *FunctionCall) JSONString() string { - b, _ := json.Marshal(fco) - return string(b) -} - -// ParseFunctionCallContext creates a new unctionCallObject from the given context -func ParseFunctionCallContext(ctx serverless.Context) (*FunctionCall, error) { - if ctx == nil { - return nil, fmt.Errorf("ai: ctx is nil") - } - - if ctx.Data() == nil { - return nil, fmt.Errorf("ai: ctx.Data() is nil") - } - - fco := &FunctionCall{ - IsOK: true, - } - fco.ctx = ctx - err := fco.FromBytes(ctx.Data()) - return fco, err -} diff --git a/ai/function_call_test.go b/ai/function_call_test.go index 60e423d83..707a3a362 100644 --- a/ai/function_call_test.go +++ b/ai/function_call_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - "github.com/yomorun/yomo/serverless/mock" ) var jsonStr = "{\"req_id\":\"yYdzyl\",\"arguments\":\"{\\n \\\"sourceTimezone\\\": \\\"America/Los_Angeles\\\",\\n \\\"targetTimezone\\\": \\\"Asia/Singapore\\\",\\n \\\"timeString\\\": \\\"2024-03-25 07:00:00\\\"\\n}\",\"tool_call_id\":\"call_aZrtm5xcLs1qtP0SWo4CZi75\",\"function_name\":\"fn-timezone-converter\",\"is_ok\":false}" @@ -41,35 +40,26 @@ func TestFunctionCallBytes(t *testing.T) { assert.Equal(t, string(bytes), jsonStr, "Original and bytes should be equal") } -func TestFunctionCallJSONString(t *testing.T) { - // Call JSONString - target := original.JSONString() - assert.Equal(t, jsonStr, target, "Original and target JSON strings should be equal") -} - -func TestFunctionCallParseCallContext(t *testing.T) { - t.Run("ctx is nil", func(t *testing.T) { - _, err := ParseFunctionCallContext(nil) - assert.Error(t, err) - }) - +func TestReadFunctionCall(t *testing.T) { t.Run("ctx.Data is nil", func(t *testing.T) { - ctx := mock.NewMockContext(nil, 0) - _, err := ParseFunctionCallContext(ctx) + ctx := NewMockContext(nil, 0) + fnCall := &FunctionCall{} + err := ctx.ReadLLMFunctionCall(fnCall) assert.Error(t, err) }) t.Run("ctx.Data is invalid", func(t *testing.T) { - ctx := mock.NewMockContext([]byte(errJSONStr), 0) - _, err := ParseFunctionCallContext(ctx) + ctx := NewMockContext([]byte(errJSONStr), 0) + fnCall := &FunctionCall{} + err := ctx.ReadLLMFunctionCall(&fnCall) assert.Error(t, err) }) } -func TestFunctionCallUnmarshalArguments(t *testing.T) { - // Unmarshal the arguments into a map +func TestReadLLMArguments(t *testing.T) { + ctx := NewMockContext([]byte(jsonStr), 0x10) target := make(map[string]string) - err := original.UnmarshalArguments(&target) + err := ctx.ReadLLMArguments(&target) assert.NoError(t, err) assert.Equal(t, "America/Los_Angeles", target["sourceTimezone"]) @@ -77,32 +67,19 @@ func TestFunctionCallUnmarshalArguments(t *testing.T) { assert.Equal(t, "2024-03-25 07:00:00", target["timeString"]) } -func TestFunctionCallWrite(t *testing.T) { - ctx := mock.NewMockContext([]byte(jsonStr), 0x10) +func TestWriteLLMResult(t *testing.T) { + ctx := NewMockContext([]byte(jsonStr), 0x10) - fco, err := ParseFunctionCallContext(ctx) + // read + target := make(map[string]string) + err := ctx.ReadLLMArguments(&target) assert.NoError(t, err) - // Call Write - err = fco.Write("test result") + // write + err = ctx.WriteLLMResult("test result") assert.NoError(t, err) res := ctx.RecordsWritten() assert.Equal(t, ReducerTag, res[0].Tag) assert.Equal(t, jsonStrWithResult("test result"), string(res[0].Data)) } - -func TestFunctionCallWriteErrors(t *testing.T) { - ctx := mock.NewMockContext([]byte(jsonStr), 0x10) - - fco, err := ParseFunctionCallContext(ctx) - assert.NoError(t, err) - - // Call WriteErrors - err = fco.WriteErrors(fmt.Errorf("test error")) - assert.NoError(t, err) - - res := ctx.RecordsWritten() - assert.Equal(t, ReducerTag, res[0].Tag) - assert.Equal(t, jsonStrWithError("test error"), string(res[0].Data)) -} diff --git a/ai/mock_context.go b/ai/mock_context.go new file mode 100644 index 000000000..c8ab52281 --- /dev/null +++ b/ai/mock_context.go @@ -0,0 +1,143 @@ +package ai + +import ( + "encoding/json" + "errors" + "sync" + + "github.com/yomorun/yomo/serverless" + "github.com/yomorun/yomo/serverless/guest" +) + +var _ serverless.Context = (*MockContext)(nil) + +// WriteRecord composes the data, tag and target. +type WriteRecord struct { + Data []byte + Tag uint32 + Target string +} + +// MockContext mock context. +type MockContext struct { + data []byte + tag uint32 + fnCall *FunctionCall + + mu sync.Mutex + wrSlice []WriteRecord +} + +// NewMockContext returns the mock context. +// the data is that returned by ctx.Data(), the tag is that returned by ctx.Tag(). +func NewMockContext(data []byte, tag uint32) *MockContext { + return &MockContext{ + data: data, + tag: tag, + } +} + +// Data incoming data. +func (c *MockContext) Data() []byte { + return c.data +} + +// Tag incoming tag. +func (c *MockContext) Tag() uint32 { + return c.tag +} + +// Metadata returns the metadata by the given key. +func (c *MockContext) Metadata(_ string) (string, bool) { + panic("not implemented") +} + +// HTTP returns the HTTP interface.H +func (m *MockContext) HTTP() serverless.HTTP { + return &guest.GuestHTTP{} +} + +// Write writes the data with the given tag. +func (c *MockContext) Write(tag uint32, data []byte) error { + c.mu.Lock() + defer c.mu.Unlock() + + c.wrSlice = append(c.wrSlice, WriteRecord{ + Data: data, + Tag: tag, + }) + + return nil +} + +// WriteWithTarget writes the data with the given tag and target. +func (c *MockContext) WriteWithTarget(tag uint32, data []byte, target string) error { + c.mu.Lock() + defer c.mu.Unlock() + + c.wrSlice = append(c.wrSlice, WriteRecord{ + Data: data, + Tag: tag, + Target: target, + }) + + return nil +} + +// ReadLLMArguments reads LLM function arguments. +func (c *MockContext) ReadLLMArguments(args any) error { + fnCall := &FunctionCall{} + err := fnCall.FromBytes(c.data) + if err != nil { + return err + } + // if success, assign the object to the given object + c.fnCall = fnCall + if len(fnCall.Arguments) == 0 && args != nil { + return errors.New("function arguments is empty, can't read to the given object") + } + return json.Unmarshal([]byte(fnCall.Arguments), args) +} + +// WriteLLMResult writes LLM function result. +func (c *MockContext) WriteLLMResult(result string) error { + c.mu.Lock() + defer c.mu.Unlock() + + if c.fnCall == nil { + return errors.New("no function call, can't write result") + } + // function call + c.fnCall.IsOK = true + c.fnCall.Result = result + buf, err := c.fnCall.Bytes() + if err != nil { + return err + } + + c.wrSlice = append(c.wrSlice, WriteRecord{ + Data: buf, + Tag: ReducerTag, + }) + return nil +} + +// ReadLLMFunctionCall reads LLM function call. +func (c *MockContext) ReadLLMFunctionCall(fnCall any) error { + if c.data == nil { + return errors.New("ctx.Data() is nil") + } + fco, ok := fnCall.(*FunctionCall) + if !ok { + return errors.New("given object is not *ai.FunctionCall") + } + return fco.FromBytes(c.data) +} + +// RecordsWritten returns the data records be written with `ctx.Write`. +func (c *MockContext) RecordsWritten() []WriteRecord { + c.mu.Lock() + defer c.mu.Unlock() + + return c.wrSlice +} diff --git a/cli/serverless/golang/templates/main.tmpl b/cli/serverless/golang/templates/main.tmpl index c5b810fea..112786561 100644 --- a/cli/serverless/golang/templates/main.tmpl +++ b/cli/serverless/golang/templates/main.tmpl @@ -17,6 +17,7 @@ var ( Run: func(cmd *cobra.Command, args []string) { run(cmd, args) }, + FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, } ) diff --git a/core/serverless/context.go b/core/serverless/context.go index b86409217..4eb84873d 100644 --- a/core/serverless/context.go +++ b/core/serverless/context.go @@ -2,6 +2,7 @@ package serverless import ( + "github.com/yomorun/yomo/ai" "github.com/yomorun/yomo/core/frame" "github.com/yomorun/yomo/core/metadata" ) @@ -12,6 +13,7 @@ type Context struct { tag uint32 md metadata.M data []byte + fnCall *ai.FunctionCall } // NewContext creates a new serverless Context diff --git a/core/serverless/context_llm.go b/core/serverless/context_llm.go new file mode 100644 index 000000000..374cfd193 --- /dev/null +++ b/core/serverless/context_llm.go @@ -0,0 +1,50 @@ +package serverless + +import ( + "encoding/json" + "errors" + + "github.com/yomorun/yomo/ai" +) + +// ReadLLMArguments reads LLM function arguments +func (c *Context) ReadLLMArguments(args any) error { + fnCall := &ai.FunctionCall{} + err := fnCall.FromBytes(c.data) + if err != nil { + return err + } + // if success, assign the object to the given object + c.fnCall = fnCall + if len(fnCall.Arguments) == 0 && args != nil { + return errors.New("function arguments is empty, can't read to the given object") + } + return json.Unmarshal([]byte(fnCall.Arguments), args) +} + +// WriteLLMResult writes LLM function result +func (c *Context) WriteLLMResult(result string) error { + if c.fnCall == nil { + return errors.New("no function call, can't write result") + } + // function call + c.fnCall.IsOK = true + c.fnCall.Result = result + buf, err := c.fnCall.Bytes() + if err != nil { + return err + } + return c.Write(ai.ReducerTag, buf) +} + +// ReadLLMFunctionCall reads LLM function call +func (c *Context) ReadLLMFunctionCall(fnCall any) error { + if c.data == nil { + return errors.New("ctx.Data() is nil") + } + fco, ok := fnCall.(*ai.FunctionCall) + if !ok { + return errors.New("given object is not *ai.FunctionCall") + } + return fco.FromBytes(c.data) +} diff --git a/example/10-ai/llm-sfn-currency-converter/app.go b/example/10-ai/llm-sfn-currency-converter/app.go index 8cd2d250a..b6e0cdf83 100644 --- a/example/10-ai/llm-sfn-currency-converter/app.go +++ b/example/10-ai/llm-sfn-currency-converter/app.go @@ -8,7 +8,6 @@ import ( "net/http" "os" - "github.com/yomorun/yomo/ai" "github.com/yomorun/yomo/serverless" ) @@ -29,14 +28,8 @@ func InputSchema() any { func Handler(ctx serverless.Context) { slog.Info("[sfn] receive", "ctx.data", string(ctx.Data())) - fcCtx, err := ai.ParseFunctionCallContext(ctx) - if err != nil { - slog.Error("[sfn] NewFunctionCallingParameters error", "err", err) - return - } - var msg Parameter - err = fcCtx.UnmarshalArguments(&msg) + err := ctx.ReadLLMArguments(&msg) if err != nil { slog.Error("[sfn] json.Marshal error", "err", err) return @@ -49,7 +42,6 @@ func Handler(ctx serverless.Context) { rate, err := fetchRate(msg.SourceCurrency, msg.TargetCurrency, msg.Amount) if err != nil { slog.Error("[sfn] >> fetchRate error", "err", err) - fcCtx.WriteErrors(err) return } @@ -58,7 +50,7 @@ func Handler(ctx serverless.Context) { result = fmt.Sprintf("can not understand the target currency %s", msg.TargetCurrency) } - err = fcCtx.Write(result) + err = ctx.WriteLLMResult(result) if err != nil { slog.Error("[sfn] >> write error", "err", err) } diff --git a/example/10-ai/llm-sfn-currency-converter/go.mod b/example/10-ai/llm-sfn-currency-converter/go.mod new file mode 100644 index 000000000..8fdd5a8e6 --- /dev/null +++ b/example/10-ai/llm-sfn-currency-converter/go.mod @@ -0,0 +1,16 @@ +module llm-sfn-currency-converter + +go 1.21.0 + +require ( + github.com/stretchr/testify v1.9.0 + github.com/yomorun/yomo v1.18.8 +) + +replace github.com/yomorun/yomo => ../../../ + +require ( + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/example/10-ai/llm-sfn-currency-converter/go.sum b/example/10-ai/llm-sfn-currency-converter/go.sum new file mode 100644 index 000000000..6678a30c4 --- /dev/null +++ b/example/10-ai/llm-sfn-currency-converter/go.sum @@ -0,0 +1,10 @@ +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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/10-ai/llm-sfn-get-ip-and-latency/app.go b/example/10-ai/llm-sfn-get-ip-and-latency/app.go index 9efd5bbce..9cf95e02d 100644 --- a/example/10-ai/llm-sfn-get-ip-and-latency/app.go +++ b/example/10-ai/llm-sfn-get-ip-and-latency/app.go @@ -5,7 +5,6 @@ import ( "log/slog" "net" - "github.com/yomorun/yomo/ai" "github.com/yomorun/yomo/serverless" "github.com/go-ping/ping" @@ -24,14 +23,8 @@ func InputSchema() any { } func Handler(ctx serverless.Context) { - fc, err := ai.ParseFunctionCallContext(ctx) - if err != nil { - slog.Error("[sfn] parse function call context", "err", err) - return - } - var msg Parameter - err = fc.UnmarshalArguments(&msg) + err := ctx.ReadLLMArguments(&msg) if err != nil { slog.Error("[sfn] unmarshal arguments", "err", err) return @@ -70,7 +63,7 @@ func Handler(ctx serverless.Context) { val := fmt.Sprintf("domain %s has ip %s with average latency %s", msg.Domain, ips[0], stats.AvgRtt) - fc.Write(val) + ctx.WriteLLMResult(val) } func DataTags() []uint32 { diff --git a/example/10-ai/llm-sfn-get-ip-and-latency/go.mod b/example/10-ai/llm-sfn-get-ip-and-latency/go.mod index 4080ca315..5d8637340 100644 --- a/example/10-ai/llm-sfn-get-ip-and-latency/go.mod +++ b/example/10-ai/llm-sfn-get-ip-and-latency/go.mod @@ -1,4 +1,4 @@ -module cc-demo +module llm-sfn-get-ip-and-latency go 1.22.1 @@ -7,7 +7,7 @@ require ( github.com/yomorun/yomo v1.18.4 ) -replace github.com/yomorun/yomo => ../../.../../../ +replace github.com/yomorun/yomo => ../../../ require ( github.com/caarlos0/env/v6 v6.10.1 // indirect diff --git a/example/10-ai/llm-sfn-get-weather/app.go b/example/10-ai/llm-sfn-get-weather/app.go index 243a1cd21..d68c8ce9d 100644 --- a/example/10-ai/llm-sfn-get-weather/app.go +++ b/example/10-ai/llm-sfn-get-weather/app.go @@ -4,7 +4,6 @@ import ( "fmt" "log/slog" "math/rand" - "os" "github.com/yomorun/yomo/ai" "github.com/yomorun/yomo/serverless" @@ -26,27 +25,28 @@ func InputSchema() any { return &Parameter{} } +// func Handler(aictx serverless.AIContext) func Handler(ctx serverless.Context) { - slog.Info("[sfn] receive", "ctx.data", string(ctx.Data())) - - fcCtx, err := ai.ParseFunctionCallContext(ctx) + slog.Info("[sfn] << receive", "ctx.data", string(ctx.Data())) + var msg Parameter + err := ctx.ReadLLMArguments(&msg) if err != nil { - slog.Error("[sfn] NewFunctionCallingParameters error", "err", err) + slog.Error("[sfn] ReadLLMArguments error", "err", err) return } - - var msg Parameter - err = fcCtx.UnmarshalArguments(&msg) - if err != nil { - slog.Error("[sfn] json.Marshal error", "err", err) - os.Exit(-2) - } else { - slog.Info("[sfn] << receive", "tag", tag, "data", msg) - data := fmt.Sprintf("[%s] temperature: %d°C", msg.CityName, rand.Intn(40)) - err = fcCtx.Write(data) - if err == nil { - slog.Info("[sfn] >> write", "tag", ai.ReducerTag, "data", data) + slog.Info("[sfn] << receive", "tag", tag, "msg", msg) + data := fmt.Sprintf("[%s] temperature: %d°C", msg.CityName, rand.Intn(40)) + // helper ai function + err = ctx.WriteLLMResult(data) + if err == nil { + slog.Info("[sfn] >> write", "tag", ai.ReducerTag, "msg", data) + fnCall := &ai.FunctionCall{} + err = ctx.ReadLLMFunctionCall(fnCall) + if err != nil { + slog.Error("[sfn] ReadLLMFunctionCall error", "err", err) + return } + slog.Info("[sfn] >> write", "tag", ai.ReducerTag, "fnCall", fnCall) } } diff --git a/example/10-ai/llm-sfn-get-weather/go.mod b/example/10-ai/llm-sfn-get-weather/go.mod new file mode 100644 index 000000000..7a2b3ad92 --- /dev/null +++ b/example/10-ai/llm-sfn-get-weather/go.mod @@ -0,0 +1,53 @@ +module llm-sfn-get-weather + +go 1.21.0 + +require github.com/yomorun/yomo v1.18.7 + +require ( + github.com/bahlo/generic-list-go v0.2.0 // indirect + github.com/buger/jsonparser v1.1.1 // indirect + github.com/caarlos0/env/v6 v6.10.1 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect + github.com/francoispqt/gojay v1.2.13 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect + github.com/invopop/jsonschema v0.12.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/matoous/go-nanoid/v2 v2.0.0 // indirect + github.com/onsi/ginkgo/v2 v2.9.5 // indirect + github.com/quic-go/quic-go v0.43.1 // indirect + github.com/robfig/cron/v3 v3.0.1 // indirect + github.com/sashabaranov/go-openai v1.23.1 // indirect + github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect + github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect + github.com/yomorun/y3 v1.0.5 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/sdk v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect + go.opentelemetry.io/proto/otlp v1.1.0 // indirect + go.uber.org/mock v0.4.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/sys v0.19.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.20.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/grpc v1.61.1 // indirect + google.golang.org/protobuf v1.32.0 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +replace github.com/yomorun/yomo => ../../../ diff --git a/example/10-ai/llm-sfn-get-weather/go.sum b/example/10-ai/llm-sfn-get-weather/go.sum new file mode 100644 index 000000000..2305ce966 --- /dev/null +++ b/example/10-ai/llm-sfn-get-weather/go.sum @@ -0,0 +1,288 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgoo= +dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= +dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= +dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= +dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= +git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= +github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= +github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= +github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= +github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= +github.com/caarlos0/env/v6 v6.10.1 h1:t1mPSxNpei6M5yAeu1qtRdPAK29Nbcf/n3G7x+b3/II= +github.com/caarlos0/env/v6 v6.10.1/go.mod h1:hvp/ryKXKipEkcuYjs9mI4bBCg+UI0Yhgm5Zu0ddvwc= +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/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= +github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/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-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= +github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI= +github.com/invopop/jsonschema v0.12.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0= +github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= +github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/matoous/go-nanoid v1.5.0/go.mod h1:zyD2a71IubI24efhpvkJz+ZwfwagzgSO6UNiFsZKN7U= +github.com/matoous/go-nanoid/v2 v2.0.0 h1:d19kur2QuLeHmJBkvYkFdhFBzLoo1XVm2GgTpL+9Tj0= +github.com/matoous/go-nanoid/v2 v2.0.0/go.mod h1:FtS4aGPVfEkxKxhdWPAspZpZSh1cOjtM7Ej/So3hR0g= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= +github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= +github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q= +github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k= +github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= +github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= +github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +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/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/quic-go/quic-go v0.43.1 h1:fLiMNfQVe9q2JvSsiXo4fXOEguXHGGl9+6gLp4RPeZQ= +github.com/quic-go/quic-go v0.43.1/go.mod h1:132kz4kL3F9vxhW3CtQJLDVwcFe5wdWeJXXijhsO57M= +github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= +github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/sashabaranov/go-openai v1.23.1 h1:b2IsEG9+BdJ3f6G3gGu9Lon2Mw/C0aYqME3YzwBHcls= +github.com/sashabaranov/go-openai v1.23.1/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= +github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= +github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= +github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= +github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= +github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= +github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= +github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= +github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= +github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= +github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= +github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= +github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= +github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= +github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= +github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= +github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= +github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= +github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= +github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= +github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= +github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= +github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= +github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= +github.com/yomorun/y3 v1.0.5 h1:1qoZrDX+47hgU2pVJgoCEpeeXEOqml/do5oHjF9Wef4= +github.com/yomorun/y3 v1.0.5/go.mod h1:+zwvZrKHe8D3fTMXNTsUsZXuI+kYxv3LRA2fSJEoWbo= +go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 h1:t6wl9SPayj+c7lEIFgm4ooDBZVb01IhLB4InpomhRw8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0/go.mod h1:iSDOcsnSA5INXzZtwaBPrKp/lWu/V14Dd+llD0oI2EA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 h1:Xw8U6u2f8DK2XAkGRFV7BBLENgnTGX9i4rQRxJf+/vs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0/go.mod h1:6KW1Fm6R/s6Z3PGXwSJN2K4eT6wQB3vXX6CVnYX9NmM= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= +go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= +go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= +go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= +golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= +golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= +golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= +golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= +google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos= +google.golang.org/genproto v0.0.0-20231212172506-995d672761c0/go.mod h1:l/k7rMz0vFTBPy+tFSGvXEd3z+BcoG1k7EHbqm+YBsY= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= +google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= +google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= +sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/example/10-ai/llm-sfn-timezone-calculator/app.go b/example/10-ai/llm-sfn-timezone-calculator/app.go index 9a9b2b563..ed5fc4b05 100644 --- a/example/10-ai/llm-sfn-timezone-calculator/app.go +++ b/example/10-ai/llm-sfn-timezone-calculator/app.go @@ -6,7 +6,6 @@ import ( "strings" "time" - "github.com/yomorun/yomo/ai" "github.com/yomorun/yomo/serverless" ) @@ -29,14 +28,8 @@ const timeFormat = "2006-01-02 15:04:05" func Handler(ctx serverless.Context) { slog.Info("[sfn] receive", "ctx.data", string(ctx.Data())) - fcCtx, err := ai.ParseFunctionCallContext(ctx) - if err != nil { - slog.Error("[sfn] NewFunctionCallingParameters error", "err", err) - return - } - var msg Parameter - err = fcCtx.UnmarshalArguments(&msg) + err := ctx.ReadLLMArguments(&msg) if err != nil { slog.Error("[sfn] json.Marshal error", "err", err) return @@ -54,7 +47,6 @@ func Handler(ctx serverless.Context) { targetTime, err := ConvertTimezone(msg.TimeString, msg.SourceTimezone, msg.TargetTimezone) if err != nil { slog.Error("[sfn] ConvertTimezone error", "err", err) - fcCtx.WriteErrors(err) return } @@ -62,7 +54,7 @@ func Handler(ctx serverless.Context) { val := fmt.Sprintf("This time in timezone %s is %s when %s in %s", msg.TargetTimezone, targetTime, msg.TimeString, msg.SourceTimezone) - fcCtx.Write(val) + ctx.WriteLLMResult(val) } func DataTags() []uint32 { diff --git a/example/10-ai/llm-sfn-timezone-calculator/go.mod b/example/10-ai/llm-sfn-timezone-calculator/go.mod new file mode 100644 index 000000000..bb34bd21d --- /dev/null +++ b/example/10-ai/llm-sfn-timezone-calculator/go.mod @@ -0,0 +1,7 @@ +module llm-sfn-timezone-calculator + +go 1.21.0 + +require github.com/yomorun/yomo v1.18.8 + +replace github.com/yomorun/yomo => ../../../ diff --git a/example/10-ai/llm-sfn-timezone-calculator/go.sum b/example/10-ai/llm-sfn-timezone-calculator/go.sum new file mode 100644 index 000000000..a10e1d10d --- /dev/null +++ b/example/10-ai/llm-sfn-timezone-calculator/go.sum @@ -0,0 +1,2 @@ +github.com/yomorun/yomo v1.18.8 h1:mZ2mPXEupSl+InwSFjRv9kv4D7BFu/fnIQYr5nr3MVk= +github.com/yomorun/yomo v1.18.8/go.mod h1:v1y0/aE1oHsMuVhy7tYni0OvB73gZqtuDODhJBfnK08= diff --git a/pkg/bridge/ai/service.go b/pkg/bridge/ai/service.go index c945e28e1..6135c00bf 100644 --- a/pkg/bridge/ai/service.go +++ b/pkg/bridge/ai/service.go @@ -152,7 +152,8 @@ func (s *Service) createReducer() (yomo.StreamFunction, error) { sfn.SetHandler(func(ctx serverless.Context) { buf := ctx.Data() ylog.Debug("[sfn-reducer]", "tag", ai.ReducerTag, "data", string(buf)) - invoke, err := ai.ParseFunctionCallContext(ctx) + invoke := &ai.FunctionCall{} + err := ctx.ReadLLMFunctionCall(invoke) if err != nil { ylog.Error("[sfn-reducer] parse function calling invoke", "err", err.Error()) return diff --git a/serverless/context.go b/serverless/context.go index cc1ad7e7f..6d173163e 100644 --- a/serverless/context.go +++ b/serverless/context.go @@ -15,6 +15,12 @@ type Context interface { HTTP() HTTP // WriteWithTarget writes data to sfn instance with specified target WriteWithTarget(tag uint32, data []byte, target string) error + // ReadLLMArguments reads LLM function arguments + ReadLLMArguments(args any) error + // WriteLLMResult writes LLM function result + WriteLLMResult(result string) error + // ReadLLMFunctionCall reads LLM function call + ReadLLMFunctionCall(fnCall any) error } // CronContext sfn corn handler context diff --git a/serverless/guest/context_llm.go b/serverless/guest/context_llm.go new file mode 100644 index 000000000..12e990465 --- /dev/null +++ b/serverless/guest/context_llm.go @@ -0,0 +1,13 @@ +package guest + +func (c *GuestContext) ReadLLMArguments(args any) error { + panic("not implemented") +} + +func (c *GuestContext) WriteLLMResult(result string) error { + panic("not implemented") +} + +func (c *GuestContext) ReadLLMFunctionCall(fnCall any) error { + panic("not implemented") +} diff --git a/serverless/mock/mock_context.go b/serverless/mock/mock_context.go deleted file mode 100644 index 1cf43b673..000000000 --- a/serverless/mock/mock_context.go +++ /dev/null @@ -1,84 +0,0 @@ -package mock - -import ( - "sync" - - "github.com/yomorun/yomo/serverless" - "github.com/yomorun/yomo/serverless/guest" -) - -var _ serverless.Context = (*MockContext)(nil) - -// WriteRecord composes the data, tag and target. -type WriteRecord struct { - Data []byte - Tag uint32 - Target string -} - -// MockContext mock context. -type MockContext struct { - data []byte - tag uint32 - - mu sync.Mutex - wrSlice []WriteRecord -} - -// NewMockContext returns the mock context. -// the data is that returned by ctx.Data(), the tag is that returned by ctx.Tag(). -func NewMockContext(data []byte, tag uint32) *MockContext { - return &MockContext{ - data: data, - tag: tag, - } -} - -func (c *MockContext) Data() []byte { - return c.data -} - -func (c *MockContext) Tag() uint32 { - return c.tag -} - -func (c *MockContext) Metadata(_ string) (string, bool) { - panic("not implemented") -} - -func (m *MockContext) HTTP() serverless.HTTP { - return &guest.GuestHTTP{} -} - -func (c *MockContext) Write(tag uint32, data []byte) error { - c.mu.Lock() - defer c.mu.Unlock() - - c.wrSlice = append(c.wrSlice, WriteRecord{ - Data: data, - Tag: tag, - }) - - return nil -} - -func (c *MockContext) WriteWithTarget(tag uint32, data []byte, target string) error { - c.mu.Lock() - defer c.mu.Unlock() - - c.wrSlice = append(c.wrSlice, WriteRecord{ - Data: data, - Tag: tag, - Target: target, - }) - - return nil -} - -// RecordsWritten returns the data records be written with `ctx.Write`. -func (c *MockContext) RecordsWritten() []WriteRecord { - c.mu.Lock() - defer c.mu.Unlock() - - return c.wrSlice -}