extract and split integration tests (#389)

This commit is contained in:
渡邉祐一 / Yuichi Watanabe
2023-06-18 19:51:20 +09:00
committed by GitHub
parent e49d771fff
commit b0959382c8
5 changed files with 357 additions and 353 deletions

View File

@@ -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)
}