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

AI cleanups #3443

Merged
merged 7 commits into from
Nov 19, 2024
Merged

AI cleanups #3443

merged 7 commits into from
Nov 19, 2024

Conversation

berekuk
Copy link
Collaborator

@berekuk berekuk commented Nov 19, 2024

  • simplify accumulated cruft around controllers
  • optional outputs and a more straightforward/type-safe API for steps
  • fix logs for finished workflows (show from stored MDX instead of rebuilding from a deserialized workflow)

@berekuk berekuk requested a review from OAGr as a code owner November 19, 2024 18:42
Copy link

changeset-bot bot commented Nov 19, 2024

⚠️ No Changeset found

Latest commit: af2d43b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Nov 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quri-hub ✅ Ready (Inspect) Visit Preview Nov 19, 2024 7:01pm
3 Skipped Deployments
Name Status Preview Updated (UTC)
quri-ui ⬜️ Ignored (Inspect) Visit Preview Nov 19, 2024 7:01pm
squiggle-components ⬜️ Ignored (Inspect) Visit Preview Nov 19, 2024 7:01pm
squiggle-website ⬜️ Ignored (Inspect) Visit Preview Nov 19, 2024 7:01pm

}

export function fixAdjustRetryLoop<Shape extends IOShape>(
export function getDefaultTransitionRule<Shape extends IOShape>(
Copy link
Collaborator Author

@berekuk berekuk Nov 19, 2024

Choose a reason for hiding this comment

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

No more "addLinearRule", this function now returns the rule itself (expressed as another function), and every specific workflow has a single rule.

I think this is as declarative as we can get, on this outer layer of configuring workflows, and this approach will hold as long as workflows are sequential.

workflow.addStep(generateCodeStep, { prompt: inputs.prompt });
},
getInitialStep: (workflow) =>
generateCodeStep.prepare({ prompt: workflow.inputs.prompt }),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This API is also new: instead of imperative "configure" = "do anything, inject even handlers", now we return the step itself.

I had to implement PreparedStep types, separate from both LLMStepTemplate and LLMStepInstance, and I'm not happy about that, but I think it was unavoidable (see the long comment on PreparedStep type in LLMStepTemplate).

outputIds: Record<string, number>;
// Legacy - in the modern format we store outputs on SerializedState, but we still support this field for old workflows.
// Can be removed if we deserialize and serialize again all workflows in the existing database.
outputIds?: Record<string, number>;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I hope I haven't broken old workflows with this change (moving outputs to step.state, and changing serialization code accordingly); as far as I can tell it's fine, i.e. old workflows still load in my dev hub instance.

Copy link
Contributor

@OAGr OAGr left a comment

Choose a reason for hiding this comment

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

Happy to generally see cleanups like this

@berekuk berekuk merged commit d0d38f0 into main Nov 19, 2024
6 checks passed
@berekuk berekuk deleted the ai-tweaks branch November 19, 2024 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants