Skip to content

Task annotation #23

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

Merged
merged 6 commits into from
Dec 5, 2024
Merged

Task annotation #23

merged 6 commits into from
Dec 5, 2024

Conversation

guillaq
Copy link
Collaborator

@guillaq guillaq commented Dec 4, 2024

Copy link

linear bot commented Dec 4, 2024

WOR-573 More pythonic WorkflowAI SDK

Playing around with the SDK it feels a little "sad".

I think we should switch to an annotation / function based syntax to match the "modern" feel of the TS SDK.

Something like:

workflowai.start()

# define task using a function
workflowai.task(schema_id=1, environment="prod") # group iteration would also go here
def city_to_capital(input: CityToCapitalTaskInput) -> CityToCapitalTaskOutput:
    ...

# usage

# using group defined in the annotation
output = await city_to_capital(CityToCapitalTaskInput(...))
# stream
async for chunk in city_to_capital(CityToCapitalTaskInput(...), stream=True):
   ...
# Trying a different version
output = await city_to_capital(CityToCapitalTaskInput(...), version=TaskVersionReference(...))

pierre yann what do you think ? I don't think it would take too much time (probably 1/2 day) and it would look A LOT better.

@guillaq guillaq force-pushed the guillaume/task-annotation branch 2 times, most recently from f03e33d to bb3b4f2 Compare December 4, 2024 22:06
yannbu
yannbu previously approved these changes Dec 5, 2024
Copy link
Contributor

@yannbu yannbu left a comment

Choose a reason for hiding this comment

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

Well done @guillaq 👏 well commented and documented. No major comments

@guillaq guillaq force-pushed the guillaume/task-annotation branch from 9fe817d to 5f9d6a9 Compare December 5, 2024 17:09
@guillaq guillaq merged commit 8229c4f into main Dec 5, 2024
5 checks passed
@guillaq guillaq deleted the guillaume/task-annotation branch December 5, 2024 17:10
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