Help us improve these docs. Take our quick survey.
curl --request POST \
--url https://api.example.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<string>",
"role": "<string>",
"name": "<string>"
}
],
"model": "<string>",
"frequency_penalty": 0,
"logit_bias": {},
"logprobs": false,
"top_logprobs": 0,
"max_tokens": 123,
"max_completion_tokens": 123,
"n": 1,
"presence_penalty": 0,
"response_format": {
"type": "text",
"json_schema": {
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": true
}
},
"seed": 0,
"stop": [],
"stream": false,
"stream_options": {
"include_usage": true,
"continuous_usage_stats": false
},
"temperature": 123,
"top_p": 123,
"tools": [
{
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
},
"type": "function"
}
],
"tool_choice": "none",
"reasoning_effort": "low",
"include_reasoning": true,
"parallel_tool_calls": true,
"user": "<string>",
"use_beam_search": false,
"top_k": 123,
"min_p": 123,
"repetition_penalty": 123,
"length_penalty": 1,
"stop_token_ids": [],
"include_stop_str_in_output": false,
"ignore_eos": false,
"min_tokens": 0,
"skip_special_tokens": true,
"spaces_between_special_tokens": true,
"truncate_prompt_tokens": 4611686018427388000,
"prompt_logprobs": 123,
"allowed_token_ids": [
123
],
"bad_words": [
"<string>"
],
"echo": false,
"add_generation_prompt": true,
"continue_final_message": false,
"add_special_tokens": false,
"documents": [
{}
],
"chat_template": "<string>",
"chat_template_kwargs": {},
"mm_processor_kwargs": {},
"structured_outputs": {
"json": "<string>",
"regex": "<string>",
"choice": [
"<string>"
],
"grammar": "<string>",
"json_object": true,
"disable_fallback": false,
"disable_any_whitespace": false,
"disable_additional_properties": false,
"whitespace_pattern": "<string>",
"structural_tag": "<string>",
"_backend": "<string>",
"_backend_was_auto": false
},
"priority": 0,
"request_id": "<string>",
"return_tokens_as_token_ids": true,
"return_token_ids": true,
"cache_salt": "<string>",
"kv_transfer_params": {},
"vllm_xargs": {},
"repetition_detection": {
"max_pattern_size": 0,
"min_pattern_size": 0,
"min_count": 0
}
}
'{
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "<string>",
"content": "<string>",
"refusal": "<string>",
"annotations": {
"type": "<string>",
"url_citation": {
"end_index": 123,
"start_index": 123,
"title": "<string>",
"url": "<string>"
}
},
"audio": {
"id": "<string>",
"data": "<string>",
"expires_at": 123,
"transcript": "<string>"
},
"function_call": {
"name": "<string>",
"arguments": "<string>"
},
"tool_calls": [
{
"function": {
"name": "<string>",
"arguments": "<string>"
},
"id": "<string>",
"type": "function"
}
],
"reasoning": "<string>"
},
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": -9999,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": -9999,
"bytes": [
123
]
}
]
}
]
},
"finish_reason": "stop",
"stop_reason": 123,
"token_ids": [
123
]
}
],
"usage": {
"prompt_tokens": 0,
"total_tokens": 0,
"completion_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 123
}
},
"id": "<string>",
"object": "chat.completion",
"created": 123,
"service_tier": "auto",
"system_fingerprint": "<string>",
"prompt_logprobs": [
{}
],
"prompt_token_ids": [
123
],
"kv_transfer_params": {}
}新しいChat Completionを作成します。
curl --request POST \
--url https://api.example.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<string>",
"role": "<string>",
"name": "<string>"
}
],
"model": "<string>",
"frequency_penalty": 0,
"logit_bias": {},
"logprobs": false,
"top_logprobs": 0,
"max_tokens": 123,
"max_completion_tokens": 123,
"n": 1,
"presence_penalty": 0,
"response_format": {
"type": "text",
"json_schema": {
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": true
}
},
"seed": 0,
"stop": [],
"stream": false,
"stream_options": {
"include_usage": true,
"continuous_usage_stats": false
},
"temperature": 123,
"top_p": 123,
"tools": [
{
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
},
"type": "function"
}
],
"tool_choice": "none",
"reasoning_effort": "low",
"include_reasoning": true,
"parallel_tool_calls": true,
"user": "<string>",
"use_beam_search": false,
"top_k": 123,
"min_p": 123,
"repetition_penalty": 123,
"length_penalty": 1,
"stop_token_ids": [],
"include_stop_str_in_output": false,
"ignore_eos": false,
"min_tokens": 0,
"skip_special_tokens": true,
"spaces_between_special_tokens": true,
"truncate_prompt_tokens": 4611686018427388000,
"prompt_logprobs": 123,
"allowed_token_ids": [
123
],
"bad_words": [
"<string>"
],
"echo": false,
"add_generation_prompt": true,
"continue_final_message": false,
"add_special_tokens": false,
"documents": [
{}
],
"chat_template": "<string>",
"chat_template_kwargs": {},
"mm_processor_kwargs": {},
"structured_outputs": {
"json": "<string>",
"regex": "<string>",
"choice": [
"<string>"
],
"grammar": "<string>",
"json_object": true,
"disable_fallback": false,
"disable_any_whitespace": false,
"disable_additional_properties": false,
"whitespace_pattern": "<string>",
"structural_tag": "<string>",
"_backend": "<string>",
"_backend_was_auto": false
},
"priority": 0,
"request_id": "<string>",
"return_tokens_as_token_ids": true,
"return_token_ids": true,
"cache_salt": "<string>",
"kv_transfer_params": {},
"vllm_xargs": {},
"repetition_detection": {
"max_pattern_size": 0,
"min_pattern_size": 0,
"min_count": 0
}
}
'{
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "<string>",
"content": "<string>",
"refusal": "<string>",
"annotations": {
"type": "<string>",
"url_citation": {
"end_index": 123,
"start_index": 123,
"title": "<string>",
"url": "<string>"
}
},
"audio": {
"id": "<string>",
"data": "<string>",
"expires_at": 123,
"transcript": "<string>"
},
"function_call": {
"name": "<string>",
"arguments": "<string>"
},
"tool_calls": [
{
"function": {
"name": "<string>",
"arguments": "<string>"
},
"id": "<string>",
"type": "function"
}
],
"reasoning": "<string>"
},
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": -9999,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": -9999,
"bytes": [
123
]
}
]
}
]
},
"finish_reason": "stop",
"stop_reason": 123,
"token_ids": [
123
]
}
],
"usage": {
"prompt_tokens": 0,
"total_tokens": 0,
"completion_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 123
}
},
"id": "<string>",
"object": "chat.completion",
"created": 123,
"service_tier": "auto",
"system_fingerprint": "<string>",
"prompt_logprobs": [
{}
],
"prompt_token_ids": [
123
],
"kv_transfer_params": {}
}Documentation Index
Fetch the complete documentation index at: https://docs.wandb.ai/llms.txt
Use this file to discover all available pages before exploring further.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
ユーザーが送信したメッセージにかかわらず、モデルが従うべき開発者指定の指示です。o1 モデル以降では、developer メッセージが従来の system メッセージに置き換わります。
Show child attributes
Show child attributes
Show child attributes
-9223372036854776000 <= x <= 9223372036854776000Show child attributes
Show child attributes
"none"low, medium, high -1 <= x <= 9223372036854776000true の場合、同じロールに属していれば、新しいメッセージは直前のメッセージの前に追加されます。
true の場合、生成プロンプトが chat template に追加されます。これは、モデルの tokenizer 設定内の chat template で使用されるパラメーターです。
これが設定されている場合、チャットは末尾のメッセージが EOS トークンなしの未完了の状態になるように整形されます。モデルは新しいメッセージを開始するのではなく、そのメッセージの続きを生成します。これにより、モデルの応答の一部を事前に埋めておくことができます。add_generation_prompt とは同時に使用できません。
true の場合、chat template によって追加されるものに加えて、特殊トークン(例: BOS)もプロンプトに追加されます。ほとんどのモデルでは、特殊トークンの追加は chat template が処理するため、これは false に設定する必要があります(デフォルト値も false です)。
モデルが RAG(検索拡張生成)を実行する場合にアクセスできるドキュメントを表す dict のリストです。テンプレートが RAG をサポートしていない場合、この引数は効果を持ちません。各ドキュメントは、"title" キーと "text" キーを含む dict にすることを推奨します。
Show child attributes
この変換に使用する Jinja テンプレートです。transformers v4.44 以降ではデフォルトの chat template は使用できないため、tokenizer で chat template が定義されていない場合は、chat template を指定する必要があります。
テンプレート renderer に渡す追加のキーワード引数です。chat template からアクセスできます。
HF processor に渡す追加の kwargs です。
structured outputs 用の追加の kwargs です。
Show child attributes
リクエストの優先度です(値が小さいほど先に処理されます。デフォルト: 0)。Serve されたモデルが優先度スケジューリングを使用していない場合、0 以外の優先度を指定するとエラーになります。
このリクエストに関連する request_id です。呼び出し元が設定しない場合は、random_uuid が生成されます。この ID は Inference プロセス全体を通じて使用され、Response で返されます。
'logprobs' を指定した場合、JSON にエンコードできない token を識別できるよう、token は 'token_id:{token_id}' 形式の文字列として表されます。
指定した場合、結果には生成されたテキストに加えて token ID も含まれます。ストリーミングモードでは、prompt_token_ids は最初の chunk にのみ含まれ、token_ids には各 chunk の差分 token が含まれます。これはデバッグ時や、生成テキストを入力 token に対応付ける必要がある場合に役立ちます。
指定した場合、複数ユーザー環境で攻撃者がプロンプトを推測することを防ぐため、prefix cache に指定した文字列でソルトを追加します。ソルトはランダムで、第三者が access できないよう保護され、かつ予測不能であるのに十分な長さである必要があります(例: 256 bit に相当する、base64 エンコードで 43 文字)。
分離サービングに使用される KVTransfer パラメーター。
custom 拡張機能で使用される、文字列または数値の値(またはその list)からなる追加の request パラメーター。
Show child attributes
出力トークン内の繰り返しのある N-gram パターンを検出するためのパラメーターです。このような繰り返しが検出された場合、生成は早期に終了します。LLM は、ときに反復的で有用でないトークン パターンを生成し、最大出力長に達するまで停止しないことがあります(例: 'abcdabcdabcd...' または '\emoji \emoji \emoji ...')。この機能は、そのような動作を検出して早期に終了し、時間とトークンを節約します。
Show child attributes
正常なレスポンス
Show child attributes
Show child attributes
"chat.completion"auto, default, flex, scale, priority Show child attributes
KVTransfer パラメーター。