Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: suport entra id #210

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions holmes/core/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ def completion(self, messages: List[Dict[str, Any]], tools: Optional[List[Tool]]
pass


def get_lite_llm_config(api_key:Optional[str], base_url:Optional[str]) -> Dict[str, Any]:

if os.environ.get("AZURE_API_BASE"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should, This just avoids setting the api_key and base_url explicitly but litellm can read these though env vars, which is how we tell users to configure holmes.

# Let litellm read environment variables
return {}

return {
"api_key": api_key,
"base_url": base_url
}


class DefaultLLM(LLM):

model: str
Expand Down Expand Up @@ -115,14 +127,13 @@ def count_tokens_for_message(self, messages: list[dict]) -> int:
def completion(self, messages: List[Dict[str, Any]], tools: Optional[List[Tool]] = [], tool_choice: Optional[Union[str, dict]] = None, response_format: Optional[Union[dict, Type[BaseModel]]] = None, temperature:Optional[float] = None, drop_params: Optional[bool] = None) -> ModelResponse:
result = litellm.completion(
model=self.model,
api_key=self.api_key,
messages=messages,
tools=tools,
tool_choice=tool_choice,
base_url=self.base_url,
temperature=temperature,
response_format=response_format,
drop_params=drop_params
drop_params=drop_params,
**get_lite_llm_config(api_key=self.api_key, base_url=self.base_url)
)


Expand Down
Loading