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

Fix output_prefix in do() method for ChatGPT Agent #2457

Merged
merged 8 commits into from
Jun 4, 2024

Conversation

Future-Outlier
Copy link
Member

@Future-Outlier Future-Outlier commented Jun 4, 2024

Tracking issue

flyteorg/flyte#3936

Why are the changes needed?

ChatGPT Agent will fail if we don't merge this PR.
(I've added a unit test to prevent the same error in the future.

What changes were proposed in this pull request?

  1. Add the output_prefix **kwargs field for ChatGPT do function.
  2. Change the order of output_prefix in SyncAgentBase for better readability.
  3. Add a unit test to mock chatgpt task's life cycle.

How was this patch tested?

unit test, local execution and single binary.

Setup process

from flytekit import task, workflow, Secret
from flytekitplugins.openai import ChatGPTTask

chatgpt_new_job = ChatGPTTask(
            name="chatgpt",
            openai_organization="org-NayNG68kGnVXMJ8Ak4PMgQv7",
            # openai_key=Secret(group="openai-remote", key="hanru"),
            # openai_organization="xxx",
            chatgpt_config={
                    "model": "gpt-3.5-turbo",
                    "temperature": 0.7,
            },
        )
if __name__ == "__main__":
    print(chatgpt_new_job(message="hi"))

Screenshots

remote execution (single binary)
image

local execution
image

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Future-Outlier and others added 4 commits June 4, 2024 11:50
Signed-off-by: Future-Outlier <[email protected]>
Co-authored-by: pingsutw  <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.61%. Comparing base (db2ff9e) to head (ec1f185).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2457      +/-   ##
==========================================
- Coverage   89.99%   86.61%   -3.38%     
==========================================
  Files          45        3      -42     
  Lines        1919      142    -1777     
==========================================
- Hits         1727      123    -1604     
+ Misses        192       19     -173     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

flytekit/extend/backend/base_agent.py Outdated Show resolved Hide resolved
flytekit/extend/backend/base_agent.py Outdated Show resolved Hide resolved
plugins/flytekit-huggingface/setup.py Outdated Show resolved Hide resolved
@pingsutw pingsutw merged commit 750a383 into master Jun 4, 2024
45 of 47 checks passed
fiedlerNr9 pushed a commit that referenced this pull request Jul 25, 2024
Signed-off-by: Future-Outlier <[email protected]>
Co-authored-by: pingsutw <[email protected]>
Signed-off-by: Jan Fiedler <[email protected]>
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.

2 participants