Skip to content

Commit fdce5d1

Browse files
committed
add input_cached_tokens span key
1 parent 5b2bf76 commit fdce5d1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

examples/prompt/ptaas/ptaas.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ func main() {
3131
}
3232
defer client.Close(ctx)
3333

34+
ctx, span := client.StartSpan(ctx, "root_span", "custom")
35+
defer span.Finish(ctx)
36+
3437
// 3. Execute prompt
3538
executeRequest := &entity.ExecuteParam{
36-
PromptKey: "ptaas_demo",
39+
PromptKey: "CozeLoop_Oncall_Master",
3740
Version: "0.0.1",
3841
VariableVals: map[string]any{
3942
"topic": "artificial intelligence",
@@ -51,6 +54,7 @@ func main() {
5154
nonStream(ctx, client, executeRequest)
5255
// 3.2 stream
5356
stream(ctx, client, executeRequest)
57+
client.Flush(ctx)
5458
}
5559

5660
func nonStream(ctx context.Context, client cozeloop.Client, executeRequest *entity.ExecuteParam) {

spec/tracespec/span_key.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const (
4141
ModelProvider = "model_provider"
4242
ModelName = "model_name"
4343
InputTokens = "input_tokens"
44+
InputCachedTokens = "input_cached_tokens"
4445
OutputTokens = "output_tokens"
4546
Tokens = "tokens"
4647
ModelPlatform = "model_platform"

0 commit comments

Comments
 (0)