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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

chatgpt wrapper #1367

Merged
merged 3 commits into from Mar 1, 2023
Merged

chatgpt wrapper #1367

merged 3 commits into from Mar 1, 2023

Conversation

hwchase17
Copy link
Contributor

No description provided.

@hwchase17 hwchase17 merged commit 4b5e850 into master Mar 1, 2023
@hwchase17 hwchase17 deleted the harrison/chatgpt branch March 1, 2023 19:47
Comment on lines +593 to +612
def _create_retry_decorator(self) -> Callable[[Any], Any]:
import openai

min_seconds = 4
max_seconds = 10
# Wait 2^x * 1 second between each retry starting with
# 4 seconds, then up to 10 seconds, then 10 seconds afterwards
return retry(
reraise=True,
stop=stop_after_attempt(self.max_retries),
wait=wait_exponential(multiplier=1, min=min_seconds, max=max_seconds),
retry=(
retry_if_exception_type(openai.error.Timeout)
| retry_if_exception_type(openai.error.APIError)
| retry_if_exception_type(openai.error.APIConnectionError)
| retry_if_exception_type(openai.error.RateLimitError)
| retry_if_exception_type(openai.error.ServiceUnavailableError)
),
before_sleep=before_sleep_log(logger, logging.WARNING),
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not just use the same method from above?

.. code-block:: python

from langchain.llms import OpenAI
openai = OpenAI(model_name="gpt-3.5-turbo")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: OpenAIChat?

ash0ts added a commit to ash0ts/langchain that referenced this pull request Mar 2, 2023
commit fe30be6
Author: Ankush Gola <9536492+agola11@users.noreply.github.com>
Date:   Wed Mar 1 21:55:43 2023 -0800

    add async and streaming support to `OpenAIChat` (langchain-ai#1378)

    title says it all

commit cfed049
Author: Lakshya Agarwal <lakshyajannu@gmail.com>
Date:   Thu Mar 2 10:48:09 2023 +0530

    Minor grammatical fixes (langchain-ai#1325)

    Fixed typos and links in a few places across documents

commit 59157b6
Author: Ryan Dao <daoduyducduong@gmail.com>
Date:   Wed Mar 1 21:15:27 2023 -0800

    Bug: Fix Python version validation in PythonAstREPLTool (langchain-ai#1373)

    The current logic checks if the Python major version is < 8, which is
    wrong. This checks if the major and minor version is < 3.9.

commit e178008
Author: Harrison Chase <hw.chase.17@gmail.com>
Date:   Wed Mar 1 21:15:13 2023 -0800

    Harrison/track token usage (langchain-ai#1382)

    Co-authored-by: Zak King <zaking17@gmail.com>

commit 1cd8996
Author: Harrison Chase <hw.chase.17@gmail.com>
Date:   Wed Mar 1 20:59:07 2023 -0800

    Harrison/summarizer chain (langchain-ai#1356)

    Co-authored-by: Tim Asp <707699+timothyasp@users.noreply.github.com>

commit cfae030
Author: yakigac <10434946+yakigac@users.noreply.github.com>
Date:   Thu Mar 2 11:24:32 2023 +0900

    Fix the openaichat example (langchain-ai#1377)

    The example was wrong.

commit 4b5e850
Author: Harrison Chase <hw.chase.17@gmail.com>
Date:   Wed Mar 1 11:47:01 2023 -0800

    chatgpt wrapper (langchain-ai#1367)

commit 4d4b43c
Author: Harrison Chase <hw.chase.17@gmail.com>
Date:   Wed Mar 1 09:40:31 2023 -0800

    fix doc names (langchain-ai#1354)

commit c01f910
Author: Harrison Chase <hw.chase.17@gmail.com>
Date:   Wed Mar 1 08:20:24 2023 -0800

    bump version to 0097 (langchain-ai#1365)

commit edb3915
Author: Christie Jacob <christeejacobs@gmail.com>
Date:   Wed Mar 1 19:21:37 2023 +0400

    typo in vectorstores (langchain-ai#1362)

commit fe7dbec
Author: Harrison Chase <hw.chase.17@gmail.com>
Date:   Tue Feb 28 22:19:11 2023 -0800

    pandas and csv agents (langchain-ai#1353)
zachschillaci27 pushed a commit to zachschillaci27/langchain that referenced this pull request Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants