adding support for Anthropic, Cohere, Replicate, Azure

This commit is contained in:
Krish Dholakia 2023-08-03 12:04:08 -07:00 committed by GitHub
parent 26b008565b
commit 102edcdcf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,7 @@ import logging
import openai import openai
from openai.error import APIError, RateLimitError, Timeout, TryAgain from openai.error import APIError, RateLimitError, Timeout, TryAgain
from retry import retry from retry import retry
from litellm import acompletion
from pr_agent.config_loader import get_settings from pr_agent.config_loader import get_settings
OPENAI_RETRIES=5 OPENAI_RETRIES=5
@ -57,7 +57,7 @@ class AiHandler:
TryAgain: If there is an attribute error during OpenAI inference. TryAgain: If there is an attribute error during OpenAI inference.
""" """
try: try:
response = await openai.ChatCompletion.acreate( response = await acompletion(
model=model, model=model,
deployment_id=self.deployment_id, deployment_id=self.deployment_id,
messages=[ messages=[