Skip to content

Commit

Permalink
Move logging to a central location for all AI Handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
zmeir committed Jan 4, 2024
1 parent ac7aaa0 commit ba3f22d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 0 additions & 5 deletions pr_agent/algo/ai_handlers/litellm_ai_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@ async def chat_completion(self, model: str, system: str, user: str, temperature:
"""
try:
deployment_id = self.deployment_id
if get_settings().config.verbosity_level >= 2:
get_logger().debug(
f"Generating completion with {model}"
f"{(' from deployment ' + deployment_id) if deployment_id else ''}"
)
if self.azure:
model = 'azure/' + model
messages = [{"role": "system", "content": system}, {"role": "user", "content": user}]
Expand Down
5 changes: 5 additions & 0 deletions pr_agent/algo/pr_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ async def retry_with_fallback_models(f: Callable):
# try each (model, deployment_id) pair until one is successful, otherwise raise exception
for i, (model, deployment_id) in enumerate(zip(all_models, all_deployments)):
try:
if get_settings().config.verbosity_level >= 2:
get_logger().debug(
f"Generating prediction with {model}"
f"{(' from deployment ' + deployment_id) if deployment_id else ''}"
)
get_settings().set("openai.deployment_id", deployment_id)
return await f(model)
except Exception as e:
Expand Down

0 comments on commit ba3f22d

Please sign in to comment.