Skip to content

Conversation

@subtleGradient
Copy link
Contributor

Add basic Effect example extracted from wrapper repo

Run biome format and fix import sorting

Copy link
Contributor Author

subtleGradient commented Nov 11, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@subtleGradient subtleGradient marked this pull request as ready for review November 11, 2025 23:59
Copilot AI review requested due to automatic review settings November 11, 2025 23:59
Copilot finished reviewing on behalf of subtleGradient November 12, 2025 00:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.ts file 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.

Comment on lines +1 to +9
/**
* 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
*/
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@subtleGradient subtleGradient force-pushed the 04-prompt-caching-effect branch from 189d80e to 9795a98 Compare November 12, 2025 22:23
@subtleGradient subtleGradient changed the base branch from 04-prompt-caching-effect to graphite-base/49 November 12, 2025 22:29
Copy link

@louisgv louisgv left a comment

Choose a reason for hiding this comment

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

nit: this one has more comment about effect than about OpenRouter

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.

3 participants