mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-20 04:20:39 +08:00
feat: support OpenAI Flex Processing via [litellm] extra_body config
This commit is contained in:
@ -364,6 +364,16 @@ class LiteLLMAIHandler(BaseAiHandler):
|
||||
raise ValueError(f"LITELLM.EXTRA_HEADERS contains invalid JSON: {str(e)}")
|
||||
kwargs["extra_headers"] = litellm_extra_headers
|
||||
|
||||
# Support for custom OpenAI body fields (e.g., Flex Processing)
|
||||
if get_settings().get("LITELLM.EXTRA_BODY", None):
|
||||
try:
|
||||
litellm_extra_body = json.loads(get_settings().litellm.extra_body)
|
||||
if not isinstance(litellm_extra_body, dict):
|
||||
raise ValueError("LITELLM.EXTRA_BODY must be a JSON object")
|
||||
kwargs.update(litellm_extra_body)
|
||||
except json.JSONDecodeError as e:
|
||||
raise ValueError(f"LITELLM.EXTRA_BODY contains invalid JSON: {str(e)}")
|
||||
|
||||
get_logger().debug("Prompts", artifact={"system": system, "user": user})
|
||||
|
||||
if get_settings().config.verbosity_level >= 2:
|
||||
|
@ -16,6 +16,10 @@ key = "" # Acquire through https://platform.openai.com
|
||||
#deployment_id = "" # The deployment name you chose when you deployed the engine
|
||||
#fallback_deployments = [] # For each fallback model specified in configuration.toml in the [config] section, specify the appropriate deployment_id
|
||||
|
||||
# OpenAI Flex Processing (optional, for cost savings)
|
||||
# [litellm]
|
||||
# extra_body='{"processing_mode": "flex"}'
|
||||
|
||||
[pinecone]
|
||||
api_key = "..."
|
||||
environment = "gcp-starter"
|
||||
|
Reference in New Issue
Block a user