Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions go/ai/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,13 @@ type ModelOptions struct {
func DefineGenerateAction(ctx context.Context, r api.Registry) *generateAction {
return (*generateAction)(core.DefineStreamingAction(r, "generate", api.ActionTypeUtil, nil, nil,
func(ctx context.Context, actionOpts *GenerateActionOptions, cb ModelStreamCallback) (resp *ModelResponse, err error) {
actionOptsBytes, _ := json.Marshal(actionOpts)
logger.FromContext(ctx).Debug("GenerateAction",
"input", fmt.Sprintf("%#v", actionOpts))
"input", actionOptsBytes)
defer func() {
respBytes, _ := json.Marshal(resp)
logger.FromContext(ctx).Debug("GenerateAction",
"output", fmt.Sprintf("%#v", resp),
"output", respBytes,
"err", err)
}()

Expand Down
6 changes: 4 additions & 2 deletions go/core/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,15 @@ func (a *ActionDef[In, Out, Stream]) Run(ctx context.Context, input In, cb Strea

// Run executes the Action's function in a new trace span.
func (a *ActionDef[In, Out, Stream]) runWithTelemetry(ctx context.Context, input In, cb StreamCallback[Stream]) (output api.ActionRunResult[Out], err error) {
inputBytes, _ := json.Marshal(input)
logger.FromContext(ctx).Debug("Action.Run",
"name", a.Name(),
"input", fmt.Sprintf("%#v", input))
"input", inputBytes)
defer func() {
outputBytes, _ := json.Marshal(output)
logger.FromContext(ctx).Debug("Action.Run",
"name", a.Name(),
"output", fmt.Sprintf("%#v", output),
"output", outputBytes,
"err", err)
}()

Expand Down
Loading