sbintuitions / JMTEB

The evaluation scripts of JMTEB (Japanese Massive Text Embedding Benchmark)
Creative Commons Attribution Share Alike 4.0 International
21 stars 3 forks source link

OpenAI Embedderにおけるinput textの長さ制限 #15

Closed lsz05 closed 4 months ago

lsz05 commented 4 months ago

OpenAI Embedderではinput textが長さ制限を超えてはいけません。 超えていたら下記のエラーが発生します。

openai.BadRequestError: Error code: 400 - {'error': {'message': "This model's maximum context length is 8192 tokens, however you requested 51435 tokens (51435 in your prompt; 0 for the completion). Please reduce your prompt; or completion length.", 'type': 'invalid_request_error', 'param': None, 'code': None}}

従ってtoken lengthを制限する必要があります。

https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken

lsz05 commented 4 months ago

17