Skip to content

Conversation

@a7m-1st
Copy link
Collaborator

@a7m-1st a7m-1st commented Jan 16, 2026

Description

from typing import Any
options = {
    "extra_params": {
        "project_id": "my_project",
        "timeout": 30,
        "api_version": "v1",
        "azure_ad_token": "token_value",
    },
    "project_id": "my_project",
}

# Build model config, defaulting to streaming for planner
extra_params = options["extra_params"] or {}
init_param_keys = {
    "api_version",
    "azure_ad_token",
    "azure_ad_token_provider",
    "max_retries",
    "timeout",
    "client",
    "async_client",
    "azure_deployment_name",
}

init_params = {}
model_config: dict[str, Any] = {}

if True:
    model_config["user"] = str(options["project_id"])
    
excluded_keys = {"model_platform", "model_type", "api_key", "url"}

# Distribute extra_params between init_params and model_config
for k, v in extra_params.items():
    if k in excluded_keys:
        continue
    # Skip empty values
    if v is None or (isinstance(v, str) and not v.strip()):
        continue
        
    if k in init_param_keys:
        init_params[k] = v
    else:
        model_config[k] = v
        
print("Init Params:", init_params)
print("Model Config:", model_config)

Output:
Init Params: {'timeout': 30, 'api_version': 'v1', 'azure_ad_token': 'token_value'}
Model Config: {'user': 'my_project', 'project_id': 'my_project'}

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@LuoPengcheng12138
Copy link
Collaborator

actually,the init_param_keys is for fix azure,and there is a pr #879 related to it but was closed now.I think the enhance is better than me.

@LuoPengcheng12138 LuoPengcheng12138 merged commit 51b2aae into feat/Disable-parallel-toolcalls Jan 16, 2026
1 check passed
@LuoPengcheng12138
Copy link
Collaborator

It’s indeed clearer!

@a7m-1st
Copy link
Collaborator Author

a7m-1st commented Jan 16, 2026

No issues thanks @LuoPengcheng12138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants