@effect/ai-openrouter
0.12.0
Patch Changes
- Updated dependencies [
fffdee0]:- effect@3.22.0
- @effect/ai@0.37.0
- @effect/experimental@0.61.0
- @effect/platform@0.97.0
0.11.0
Patch Changes
0.10.1
Patch Changes
-
#6145
6c39a34Thanks @LikiosSedo! - Fix typo in HTTP header name:HTTP-Referrer→HTTP-Referer. The HTTP spec spells it “Referer” (single r), and OpenRouter expects this exact header name for app attribution. -
Updated dependencies [
f99048e]:- effect@3.21.1
0.10.0
Patch Changes
- Updated dependencies [
f7bb09b,bd7552a,ad1a7eb,0d32048,0d32048]:- effect@3.21.0
- @effect/ai@0.35.0
- @effect/experimental@0.60.0
- @effect/platform@0.96.0
0.9.1
Patch Changes
-
#6131
5c80e57Thanks @fabstorres! - Allow partial tool_call deltas in OpenRouter streaming -
Updated dependencies [
add06f4,a03b6a2]:- effect@3.20.1
0.9.0
Patch Changes
-
#6117
7103e24Thanks @nickbreaton! - Fix OpenRouter streaming finalization for usage-only terminal chunks. -
Updated dependencies [
fc82e81,82996bc,4d97a61,f6b0960,8798a84]:- effect@3.20.0
- @effect/ai@0.34.0
- @effect/experimental@0.59.0
- @effect/platform@0.95.0
0.8.4
Patch Changes
-
#6071
a91364dThanks @marbemac! - FixChatStreamingMessageToolCallschema rejecting valid streaming tool call chunks.The OpenAI streaming spec splits tool calls across multiple SSE chunks —
function.nameis only present on the first chunk, but the schema required it on every chunk, causing aMalformedOutputerror whenever the model returned a tool call.Made
function.nameoptional to matchidwhich was already optional.
0.8.3
Patch Changes
-
#6060
c3e706fThanks @nvonbulow! - fix(ai-openrouter): deduplicate reasoning parts when bothreasoningandreasoning_detailsare present in a stream delta -
Updated dependencies [
d67c708,a8c436f]:- @effect/platform@0.94.5
- effect@3.19.17
0.8.2
Patch Changes
-
#6026
38241deThanks @IMax153! - Fix the OpenRouter AI provider schemas -
Updated dependencies [
0023c19,e71889f,9a96b87]:- @effect/platform@0.94.3
- effect@3.19.16
0.8.1
Patch Changes
-
#5928
34fbbb1Thanks @harrysolovay! - Regenerate OpenRouter schemas to fix schema validation. -
Updated dependencies [
65e9e35,ee69cd7,488d6e8,ba9e790]:- @effect/platform@0.94.1
- effect@3.19.14
- @effect/ai@0.33.1
0.8.0
Patch Changes
- Updated dependencies [
77eeb86,ff7053f,287c32c]:- effect@3.19.13
- @effect/platform@0.94.0
- @effect/ai@0.33.0
- @effect/experimental@0.58.0
0.7.1
Patch Changes
-
#5799
5d7c9d8Thanks @subtleGradient! - Add support for google-gemini-v1 reasoning format -
Updated dependencies [
65bff45]:- @effect/platform@0.93.7
0.7.0
Minor Changes
Patch Changes
- Updated dependencies [
96c9537]:- @effect/experimental@0.57.10
0.6.0
Patch Changes
- Updated dependencies [
3c15d5f,3863fa8,2a03c76,24a1685]:- effect@3.19.0
- @effect/platform@0.93.0
- @effect/ai@0.32.0
- @effect/experimental@0.57.0
0.5.0
Minor Changes
-
#5621
4c3bdfbThanks @IMax153! - RemoveEither/EitherEncodedfrom tool call results.Specifically, the encoding of tool call results as an
Either/EitherEncodedhas been removed and is replaced by encoding the tool call success / failure directly into theresultproperty.To allow type-safe discrimination between a tool call result which was a success vs. one that was a failure, an
isFailureproperty has also been added to the"tool-result"part. IfisFailureistrue, then the tool call handler result was an error.import * as AnthropicClient from "@effect/ai-anthropic/AnthropicClient"import * as AnthropicLanguageModel from "@effect/ai-anthropic/AnthropicLanguageModel"import * as LanguageModel from "@effect/ai/LanguageModel"import * as Tool from "@effect/ai/Tool"import * as Toolkit from "@effect/ai/Toolkit"import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient"import { Config, Effect, Layer, Schema, Stream } from "effect"const Claude = AnthropicLanguageModel.model("claude-4-sonnet-20250514")const MyTool = Tool.make("MyTool", {description: "An example of a tool with success and failure types",failureMode: "return", // Return errors in the responseparameters: { bar: Schema.Number },success: Schema.Number,failure: Schema.Struct({ reason: Schema.Literal("reason-1", "reason-2") })})const MyToolkit = Toolkit.make(MyTool)const MyToolkitLayer = MyToolkit.toLayer({MyTool: () => Effect.succeed(42)})const program = LanguageModel.streamText({prompt: "Tell me about the meaning of life",toolkit: MyToolkit}).pipe(Stream.runForEach((part) => {if (part.type === "tool-result" && part.name === "MyTool") {// The `isFailure` property can be used to discriminate whether the result// of a tool call is a success or a failureif (part.isFailure) {part.result// ^? { readonly reason: "reason-1" | "reason-2"; }} else {part.result// ^? number}}return Effect.void}),Effect.provide(Claude))const Anthropic = AnthropicClient.layerConfig({apiKey: Config.redacted("ANTHROPIC_API_KEY")}).pipe(Layer.provide(NodeHttpClient.layerUndici))program.pipe(Effect.provide([Anthropic, MyToolkitLayer]), Effect.runPromise)
Patch Changes
- Updated dependencies [
4c3bdfb]:- @effect/ai@0.31.0
0.4.0
Minor Changes
-
#5614
c63e658Thanks @IMax153! - Previously, tool call handler errors were always raised as an expected error in the EffectEchannel at the point of execution of the tool call handler (i.e. when agenerate*method is invoked on aLanguageModel).With this PR, the end user now has control over whether tool call handler errors should be raised as an Effect error, or returned by the SDK to allow, for example, sending that error information to another application.
Tool Call Specification
The
Tool.makeandTool.providerDefinedconstructors now take an extra optional parameter calledfailureMode, which can be set to either"error"or"return".import { Tool } from "@effect/ai"import { Schema } from "effect"const MyTool = Tool.make("MyTool", {description: "My special tool",failureMode: "return" // "error" (default) or "return"parameters: {myParam: Schema.String},success: Schema.Struct({mySuccess: Schema.String}),failure: Schema.Struct({myFailure: Schema.String})})The semantics of
failureModeare as follows:- If set to
"error"(the default), errors that occur during tool call handler execution will be returned in the error channel of the calling effect - If set to
"return", errors that occur during tool call handler execution will be captured and returned as part of the tool call result
Response - Tool Result Parts
The
resultfield of a"tool-result"part of a large language model provider response is now represented as anEither.- If the
resultis aLeft, theresultwill be thefailurespecified in the tool call specification - If the
resultis aRight, theresultwill be thesuccessspecified in the tool call specification
This is only relevant if the end user sets
failureModeto"return". If set to"error"(the default), then theresultproperty will always be aRightwith the successful result of the tool call handler.Similarly the
encodedResultfield of a"tool-result"part will be represented as anEitherEncoded, where:{ _tag: "Left", left: <failure> }represents a tool call handler failure{ _tag: "Right", right: <success> }represents a tool call handler success
Prompt - Tool Result Parts
The
resultfield of a"tool-result"part of a prompt will now only accept anEitherEncodedas specified above. - If set to
Patch Changes
0.3.0
Patch Changes
- Updated dependencies [
1c6ab74,70fe803,c296e32,a098ddf,f8b93ac]:- effect@3.18.0
- @effect/ai@0.29.0
- @effect/platform@0.92.0
- @effect/experimental@0.56.0
0.2.1
Patch Changes
- #5571
122aa53Thanks @IMax153! - Ensure that AI provider clients filter response status for stream requests
0.2.0
Patch Changes
- Updated dependencies [
d4d86a8]:- @effect/platform@0.91.0
- @effect/ai@0.28.0
- @effect/experimental@0.55.0