Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit39d3805

Browse files
committed
chore: improve comments
1 parent9ecbe62 commit39d3805

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

‎coderd/taskname/taskname.go‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@ func generateFallback() TaskName {
112112
// We have a 5 character suffix `-ffff`.
113113
// This leaves us with 27 characters for the name.
114114
//
115-
// Unfortunately, `namesgenerator.GetRandomName(0)` will
116-
// generate names that are longer than 27 characters, so
117-
// we just trim these down to length.
115+
// `namesgenerator.GetRandomName(0)` can generate names
116+
// up to 27 characters, but we truncate defensively.
118117
name:=strings.ReplaceAll(namesgenerator.GetRandomName(0),"_","-")
119118
name=name[:min(len(name),27)]
120119
name=strings.TrimSuffix(name,"-")
@@ -297,8 +296,15 @@ func anthropicDataStream(ctx context.Context, client anthropic.Client, model ant
297296
}
298297

299298
returnaisdk.AnthropicToDataStream(client.Messages.NewStreaming(ctx, anthropic.MessageNewParams{
300-
Model:model,
301-
MaxTokens:50,
299+
Model:model,
300+
// MaxTokens is set to 100 based on the maximum expected output size.
301+
// The worst-case JSON output is 134 characters:
302+
// - Base structure: 43 chars (including formatting)
303+
// - task_name: 27 chars max
304+
// - display_name: 64 chars max
305+
// Using Anthropic's token counting API, this worst-case output tokenizes to 70 tokens.
306+
// We set MaxTokens to 100 to provide a safety buffer.
307+
MaxTokens:100,
302308
System:system,
303309
Messages:messages,
304310
})),nil

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp