(ctx context.Context, req *aibridge.ToolUsageRecord)
| 88 | } |
| 89 | |
| 90 | func (t *recorderTranslation) RecordToolUsage(ctx context.Context, req *aibridge.ToolUsageRecord) error { |
| 91 | serialized, err := json.Marshal(req.Args) |
| 92 | if err != nil { |
| 93 | return xerrors.Errorf("serialize tool %q args: %w", req.Tool, err) |
| 94 | } |
| 95 | |
| 96 | var invErr *string |
| 97 | if req.InvocationError != nil { |
| 98 | invErr = ptr.Ref(req.InvocationError.Error()) |
| 99 | } |
| 100 | |
| 101 | _, err = t.client.RecordToolUsage(ctx, &proto.RecordToolUsageRequest{ |
| 102 | InterceptionId: req.InterceptionID, |
| 103 | MsgId: req.MsgID, |
| 104 | ToolCallId: req.ToolCallID, |
| 105 | ServerUrl: req.ServerURL, |
| 106 | Tool: req.Tool, |
| 107 | Input: string(serialized), |
| 108 | Injected: req.Injected, |
| 109 | InvocationError: invErr, |
| 110 | Metadata: marshalForProto(req.Metadata), |
| 111 | CreatedAt: timestamppb.New(req.CreatedAt), |
| 112 | }) |
| 113 | return err |
| 114 | } |
| 115 | |
| 116 | func (t *recorderTranslation) RecordModelThought(ctx context.Context, req *aibridge.ModelThoughtRecord) error { |
| 117 | _, err := t.client.RecordModelThought(ctx, &proto.RecordModelThoughtRequest{ |
nothing calls this directly
no test coverage detected