Runnable v2 code examples#331
Conversation
|
|
||
|
|
||
| @llm.call(provider="openai", model_id="gpt-5", tools=[get_book_info]) | ||
| @llm.call(provider="anthropic", model_id="claude-sonnet-4-0", tools=[get_book_info]) |
There was a problem hiding this comment.
nit: we might want to use a more recent 4.5 series model in these examples
There was a problem hiding this comment.
absolutely. examples are sync'd from the mirascope repo so ideally all these changes need to be made upstream.
There was a problem hiding this comment.
Ah yes, @teamdandelion has been doing that. I think we can leave as-is for now and worry about this later after we port the website in Mirascope/mirascope (we've made it a monorepo now where we're putting everything)
|
|
||
|
|
||
| @llm.call(provider="openai:responses", model_id="gpt-5", thinking=True) | ||
| @llm.call(provider="openai:responses", model_id="claude-sonnet-4-0", thinking=True) |
There was a problem hiding this comment.
this is incorrect. an upcoming release of v2 alpha will make this impossible (since provider and model id will be a single string)
| print(response.pretty()) | ||
|
|
||
| with llm.model(provider="openai:responses", model_id="gpt-5", thinking=False): | ||
| with llm.model(provider="openai:responses", model_id="claude-sonnet-4-0", thinking=False): |
teamdandelion
left a comment
There was a problem hiding this comment.
Nice work! Besides the inline comments, my main questions are around maintainability and CI integration. As I understand it:
- CI checks for every cassette file that it is fresh w.r.t. the corresponding py file
- We know the py file was runnable as-written (post transformations) because that generated said cassette file
- We can (with a fix I requested elsewhere) ensure that every py file has a matching cassette
Ergo, CI being green gives us an assurance that every example has a matching cassette and will run correctly in browser. Does that track?
A part of me wonders about having a CI job that actually loads pyodide in the bun test environment and tries running every example just to be sure, but that may be unnecessary (maybe we build that out only if we start actually seeing flakes)
| const sensitiveKeys = [ | ||
| "x-api-key", | ||
| "authorization", | ||
| "x-auth-token", | ||
| "api-key", | ||
| "x-anthropic-api-key", | ||
| "x-openai-api-key", | ||
| ]; |
There was a problem hiding this comment.
Hmm, I wonder if we can come up with a strategy to ensure synchronization between the sensitive keys here and in the mirascope vcr.py config. So as to ensure that we don't add a new provider, strip the key in Mirascope snapshots, but accidentally leak them here.
There was a problem hiding this comment.
I think this is somewhat related to (1) porting the website over into Mirascope/mirascope and (2) refactoring the MLX and Grok custom caching into a more reusable upgrade to VCR. Perhaps we can import the VCR config here from the mirascope tests to keep them in sync.
| @@ -0,0 +1,123 @@ | |||
| "use client"; | |||
There was a problem hiding this comment.
Are we actually using all these new components? I would love to slim this down to just components that are actually in use.
There was a problem hiding this comment.
Agreed. We don't need all of them.
I was going to drop the unnecessary ones as part of upstreaming <CodeBlock .../> into mirascope-ui once the UX is settled which is still pending.
| @@ -0,0 +1,60 @@ | |||
| import * as React from "react"; | |||
There was a problem hiding this comment.
Likewise, do we actually need all the new components here?
|
|
||
| console.log(`Validating cassette files in ${targetPath}...`); | ||
|
|
||
| const results = await validateCassetteDirectory(targetPath); |
There was a problem hiding this comment.
I believe this will not catch the case where there are new python example files that are missing cassettes
|
Somehow VCR.py v8 breaks using the cached cassettes inside of Pyodide using Anthropic 🤦. Not going to diagnose this deeper since we're backing out Pyodide/WASM for now. |
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
8b8d504 to
34d45ac
Compare
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
…s done Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
34d45ac to
86ba819
Compare
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
… display it Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <sebastiantiedtke@gmail.com>
|
Opening a new PR since we've decided to directions. Superseded by #336. |
This PR introduces a Pyodide runtime to exclusively running Mirascope v2's Anthropic examples (their SDK is Pyodide compatible) with pre-recorded cached HTTP interactions.
Here's what's implemented:
/docs/mirascope/v2cachedHTTP/README.md.What's missing: