@ -103,11 +103,7 @@ def _create_retry_decorator(
import openai
import openai
errors = [
errors = [
<< << << < HEAD
openai . Timeout ,
== == == =
openai . error . Timeout ,
openai . error . Timeout ,
>> >> >> > master
openai . error . APIError ,
openai . error . APIError ,
openai . error . APIConnectionError ,
openai . error . APIConnectionError ,
openai . error . RateLimitError ,
openai . error . RateLimitError ,
@ -124,16 +120,8 @@ def completion_with_retry(
* * kwargs : Any ,
* * kwargs : Any ,
) - > Any :
) - > Any :
""" Use tenacity to retry the completion call. """
""" Use tenacity to retry the completion call. """
<< << << < HEAD
if is_openai_v1 ( ) :
return llm . client . create ( * * kwargs )
retry_decorator = _create_retry_decorator ( llm , run_manager = run_manager )
== == == =
retry_decorator = _create_retry_decorator ( llm , run_manager = run_manager )
retry_decorator = _create_retry_decorator ( llm , run_manager = run_manager )
>> >> >> > master
@retry_decorator
@retry_decorator
def _completion_with_retry ( * * kwargs : Any ) - > Any :
def _completion_with_retry ( * * kwargs : Any ) - > Any :
return llm . client . create ( * * kwargs )
return llm . client . create ( * * kwargs )
@ -147,16 +135,8 @@ async def acompletion_with_retry(
* * kwargs : Any ,
* * kwargs : Any ,
) - > Any :
) - > Any :
""" Use tenacity to retry the async completion call. """
""" Use tenacity to retry the async completion call. """
<< << << < HEAD
if is_openai_v1 ( ) :
return await llm . async_client . create ( * * kwargs )
retry_decorator = _create_retry_decorator ( llm , run_manager = run_manager )
== == == =
retry_decorator = _create_retry_decorator ( llm , run_manager = run_manager )
retry_decorator = _create_retry_decorator ( llm , run_manager = run_manager )
>> >> >> > master
@retry_decorator
@retry_decorator
async def _completion_with_retry ( * * kwargs : Any ) - > Any :
async def _completion_with_retry ( * * kwargs : Any ) - > Any :
# Use OpenAI's async api https://github.com/openai/openai-python#async-api
# Use OpenAI's async api https://github.com/openai/openai-python#async-api
@ -618,12 +598,7 @@ class BaseOpenAI(BaseLLM):
if self . openai_proxy :
if self . openai_proxy :
import openai
import openai
<< << << < HEAD
# TODO: The 'openai.proxy' option isn't read in the client API. You will need to pass it when you instantiate the client, e.g. 'OpenAI(proxy={"http": self.openai_proxy, "https": self.openai_proxy})'
# openai.proxy = {"http": self.openai_proxy, "https": self.openai_proxy} # type: ignore[assignment] # noqa: E501
== == == =
openai . proxy = { " http " : self . openai_proxy , " https " : self . openai_proxy } # type: ignore[assignment] # noqa: E501
openai . proxy = { " http " : self . openai_proxy , " https " : self . openai_proxy } # type: ignore[assignment] # noqa: E501
>> >> >> > master
return { * * openai_creds , * * self . _default_params }
return { * * openai_creds , * * self . _default_params }
@property
@property