Add basic Effect example extracted from wrapper repo#49
Add basic Effect example extracted from wrapper repo#49subtleGradient wants to merge 4 commits intomainfrom
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds a basic introductory example for using OpenRouter with @effect/ai and @effect/ai-openrouter, demonstrating fundamental Effect-TS patterns for AI interactions. The example was extracted from a wrapper repository and has been formatted according to the project's code style.
- Adds a new
src/basic/example.tsfile demonstrating Effect-TS patterns - Includes three examples: simple text generation, stateful chat conversations, and streaming responses
- Follows existing code patterns with layer-based dependency injection and Effect.gen composition
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** | ||
| * Example: Using OpenRouter with @effect/ai and @effect/ai-openrouter | ||
| * | ||
| * This example demonstrates idiomatic Effect patterns for AI interactions: | ||
| * - Effect.gen for generator-style effect composition | ||
| * - Layer-based dependency injection | ||
| * - Type-safe error handling with Effect | ||
| * - Streaming responses with Effect streams | ||
| */ |
There was a problem hiding this comment.
The new basic example is not included in the package.json scripts. The current examples script only runs the prompt-caching examples. Consider updating the package.json to include this new basic example:
"scripts": {
"examples": "bun run src/basic/example.ts && bun run src/prompt-caching/...",
"typecheck": "tsc --noEmit"
}Alternatively, if this is intentional, consider documenting how to run this example in the README or in a comment at the top of the file.
189d80e to
9795a98
Compare
a828c0d to
27587c3
Compare
27587c3 to
eec029a
Compare
9795a98 to
9c1f09c
Compare
louisgv
left a comment
There was a problem hiding this comment.
nit: this one has more comment about effect than about OpenRouter
eec029a to
b6c721d
Compare
9c1f09c to
2fbc45d
Compare
b6c721d to
b67a3a1
Compare
2fbc45d to
ce141a2
Compare
b67a3a1 to
189ddb4
Compare

Add basic Effect example extracted from wrapper repo
Run biome format and fix import sorting