extract and split integration tests (#389)
This commit is contained in:
committed by
GitHub
parent
e49d771fff
commit
b0959382c8
@@ -26,3 +26,12 @@ func setupAzureTestServer() (client *Client, server *test.ServerTest, teardown f
|
||||
client = NewClientWithConfig(config)
|
||||
return
|
||||
}
|
||||
|
||||
// numTokens Returns the number of GPT-3 encoded tokens in the given text.
|
||||
// This function approximates based on the rule of thumb stated by OpenAI:
|
||||
// https://beta.openai.com/tokenizer
|
||||
//
|
||||
// TODO: implement an actual tokenizer for GPT-3 and Codex (once available)
|
||||
func numTokens(s string) int {
|
||||
return int(float32(len(s)) / 4)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user