mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
docs: add context limit and strategy to LLM model configs API
- Add `context_limit` as required field for LLM model configurations - Add `context_strategy` as optional field with three trimming strategies - Update API documentation with detailed examples for GPT-4o and Claude 3.5 Sonnet - Clarify that context limit is specified in K tokens (thousands of tokens) - Update example payloads to reflect current model versions and new fields
This commit is contained in:
1 parent
6a9f745c13
commit
7368ac098a
7 files changed
+1246
-25
No files matched your search
@@ -182,6 +182,9 @@ async def create_user_llm_model_config(
|
||||
Create a new LLM model configuration for a user.
|
||||
|
||||
Required privilege: User.Modify
|
||||
|
||||
IMPORTANT: context_limit is REQUIRED. Unit is K tokens (e.g., 128 = 128K = 128,000 tokens).
|
||||
Please check your model provider's documentation for the current context window size.
|
||||
"""
|
||||
|
||||
# Verify user exists
|
||||
@@ -189,6 +192,14 @@ async def create_user_llm_model_config(
|
||||
if not user:
|
||||
raise ControllerNotFoundError(f"User '{user_id}' not found")
|
||||
|
||||
# Validate context_limit is provided
|
||||
if not hasattr(config_create, 'context_limit') or config_create.context_limit is None:
|
||||
raise ControllerBadRequestError(
|
||||
"context_limit is required (unit: K tokens, e.g., 128 = 128K = 128,000 tokens). "
|
||||
"Please check your model provider's documentation for the current context window size "
|
||||
"and specify it in the configuration."
|
||||
)
|
||||
|
||||
try:
|
||||
# Extract config fields (excluding table-level fields)
|
||||
config_fields = config_create.model_dump(exclude={"name", "model_type", "is_default"})
|
||||
@@ -493,6 +504,9 @@ async def create_group_llm_model_config(
|
||||
Create a new LLM model configuration for a user group.
|
||||
|
||||
Required privilege: Group.Modify
|
||||
|
||||
IMPORTANT: context_limit is REQUIRED. Unit is K tokens (e.g., 128 = 128K = 128,000 tokens).
|
||||
Please check your model provider's documentation for the current context window size.
|
||||
"""
|
||||
|
||||
# Verify group exists
|
||||
@@ -500,6 +514,14 @@ async def create_group_llm_model_config(
|
||||
if not group:
|
||||
raise ControllerNotFoundError(f"User group '{group_id}' not found")
|
||||
|
||||
# Validate context_limit is provided
|
||||
if not hasattr(config_create, 'context_limit') or config_create.context_limit is None:
|
||||
raise ControllerBadRequestError(
|
||||
"context_limit is required (unit: K tokens, e.g., 128 = 128K = 128,000 tokens). "
|
||||
"Please check your model provider's documentation for the current context window size "
|
||||
"and specify it in the configuration."
|
||||
)
|
||||
|
||||
try:
|
||||
# Extract config fields (excluding table-level fields)
|
||||
config_fields = config_create.model_dump(exclude={"name", "model_type", "is_default"})
|
||||
|
||||
Reference in new issue
Block a user