-
Notifications
You must be signed in to change notification settings - Fork 2
Runnable code examples v3 #336
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
…s done Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
… display it Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
|
Based on my notes, this is ready for review, @willbakst & @teamdandelion. I assume https://github.com/Mirascope/ui remains relevant. Once we've got a thumbs on the review, I'll upstream the relevant |
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
teamdandelion
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some general comments. A little unclear on what the scope is now. Going to ask you about it offline
| "content/docs/mirascope/v2/examples/**/*.{yaml,py}": [ | ||
| "bun scripts/validate-cassettes.ts" | ||
| ], | ||
| "cassettes/**/*.{yaml,py}": [ | ||
| "bun scripts/validate-cassettes.ts" | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to prefer invoking directly vs bun run lint:cassettes? I feel like bun run lint:cassetes is more dry. Also is there a reason we have bun [script] here vs bun run [script] above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈! I didn't even see that the run was missing. Definitely a mistake. I'm surprised this works.
Thanks for the catch!
| } | ||
|
|
||
| // Default glob pattern validation (runs if no targetFile or targetFile is not a .py file) | ||
| const defaultGlobPattern = "content/docs/mirascope/v2/examples/**/*.py"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice we're hardcoding this in a few places, feels like a bit of a smell. Wonder if it might make sense to pull these all out of the commands and provide them as args in package.json
| @@ -0,0 +1,123 @@ | |||
| "use client"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel super strongly about this, but I notice once again we're pulling in all of the ai-elements even thoujgh I don't think we'll use them all (and some are redundant w. our own components like code-block)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove the excess components from this branch. Originally planned to do this as part of upstreaming into mirascope-ui which I understand now will no longer be required.
| import type { | ||
| WorkerRequest, | ||
| WorkerResponse, | ||
| WorkerStreamEvent, | ||
| } from "@/src/workers/pyodide-worker-types"; | ||
|
|
||
| const DEFAULT_PYODIDE_URL = `https://cdn.jsdelivr.net/pyodide/v${version}/full/`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we were moving away from the pyodide based approach? Do we use this code or are we bringing it in eagerly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. As per the description, I want to make sure a potential git-squash won't deprive the history of Pyodide/WASM should they become relevant again.
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
As discussed, this PR introduces runnable code blocks that replay VCR.py cassettes (cached HTTP) directly. In it's current implementation it works with both request/streaming Anthropic responses. There's ground work to add other SDK's API responses but it's not complete. Check out the short video demo below.
I've addressed almost all relevant review feedback in #331.
While there's a
bun run lint:cassettes --strictmode now that alerts for missing cassettes, it's not default yet. The idea is to makestrictdefault and further close the gap to @teamdandelion's goals here #331 (review) in a separate effort. The presence of a cassette per code-block currently toggles if arun buttonis shown, which is why there's no "pending state" on every code block'srun buttonyet until VCR cassettes are ubiquitous.PS: Heads up, I had to upgrade to latest
bun v1.3.3which just releasedDecompressionStreamsupport last week.Pending items:
mirascope-uicomponents.run buttoneverywhere rolloutAnalyticsCodeBlockfor running codeRunnableContext.tsxand pyodide worker files. If this PR is squashed, I'd rather remove them in a separate PR to leave a record in the git history.Video
replay.mp4