mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-12 01:28:30 +00:00
feat: add extra_headers parameter to LLM class
- Add extra_headers parameter to LLM constructor for custom authentication headers - Update _prepare_completion_params to pass extra_headers to LiteLLM - Add comprehensive tests for extra_headers functionality - Ensure backward compatibility with None default value Fixes #3177 Co-Authored-By: Jo\u00E3o <joao@crewai.com>
This commit is contained in:
@@ -311,6 +311,7 @@ class LLM(BaseLLM):
|
||||
callbacks: List[Any] = [],
|
||||
reasoning_effort: Optional[Literal["none", "low", "medium", "high"]] = None,
|
||||
stream: bool = False,
|
||||
extra_headers: Optional[Dict[str, str]] = None,
|
||||
**kwargs,
|
||||
):
|
||||
self.model = model
|
||||
@@ -337,6 +338,7 @@ class LLM(BaseLLM):
|
||||
self.additional_params = kwargs
|
||||
self.is_anthropic = self._is_anthropic_model(model)
|
||||
self.stream = stream
|
||||
self.extra_headers = extra_headers
|
||||
|
||||
litellm.drop_params = True
|
||||
|
||||
@@ -408,6 +410,7 @@ class LLM(BaseLLM):
|
||||
"stream": self.stream,
|
||||
"tools": tools,
|
||||
"reasoning_effort": self.reasoning_effort,
|
||||
"extra_headers": self.extra_headers,
|
||||
**self.additional_params,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user