MCPcopy Create free account
hub / github.com/appleboy/CodeGPT / String

Method String

core/openai.go:23–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21}
22
23func (u Usage) String() string {
24 s := "Prompt tokens: " + strconv.Itoa(u.PromptTokens)
25 if u.PromptTokensDetails != nil && u.PromptTokensDetails.CachedTokens > 0 {
26 s += " (CachedTokens: " + strconv.Itoa(u.PromptTokensDetails.CachedTokens) + ")"
27 }
28 s += ", Completion tokens: " + strconv.Itoa(u.CompletionTokens)
29 if u.CompletionTokensDetails != nil && u.CompletionTokensDetails.ReasoningTokens > 0 {
30 s += " (ReasoningTokens: " + strconv.Itoa(u.CompletionTokensDetails.ReasoningTokens) + ")"
31 }
32 s += ", Total tokens: " + strconv.Itoa(u.TotalTokens)
33 return s
34}
35
36// Response represents the structure of a response from the OpenAI API.
37// It contains the content of the response and the usage information.

Callers 15

TestUsageStringFunction · 0.45
review.goFile · 0.45
commit.goFile · 0.45
initFunction · 0.45
CompletionStreamMethod · 0.45
RoundTripMethod · 0.45
CompletionStreamMethod · 0.45
TestCompletionStreamFunction · 0.45
TestCompletionStreamFunction · 0.45
CompletionStreamMethod · 0.45
GetAPIKeyFromHelperFunction · 0.45
TestProcessTemplateFunction · 0.45

Calls

no outgoing calls

Tested by 7

TestUsageStringFunction · 0.36
RoundTripMethod · 0.36
TestCompletionStreamFunction · 0.36
TestCompletionStreamFunction · 0.36
TestProcessTemplateFunction · 0.36
TestLoadTemplatesFromDirFunction · 0.36
TestLoadTemplatesFunction · 0.36