@effect-uai/responses 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +45 -0
- package/dist/chunk-CfYAbeIz.mjs +13 -0
- package/dist/index.d.mts +828 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +525 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +54 -0
- package/src/Responses.ts +316 -0
- package/src/codec.ts +298 -0
- package/src/index.ts +4 -0
- package/src/models.ts +24 -0
- package/src/streamEvents.ts +199 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Betalyra Sociedade Unipessoal Lda.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @effect-uai/responses
|
|
2
|
+
|
|
3
|
+
OpenAI Responses API provider for [`@effect-uai/core`](https://www.npmjs.com/package/@effect-uai/core).
|
|
4
|
+
|
|
5
|
+
Implements the `LanguageModel` contract against OpenAI's Responses API
|
|
6
|
+
(`POST /v1/responses` with SSE streaming). Provider-specific options
|
|
7
|
+
(`reasoning.effort`, `store`, `previousResponseId`) are reachable at
|
|
8
|
+
the call site without polluting the cross-provider surface.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
pnpm add @effect-uai/responses @effect-uai/core effect
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
ESM-only. Requires `effect@4.x` and `@effect-uai/core` as peers.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Config, Effect, Layer } from "effect"
|
|
22
|
+
import { FetchHttpClient } from "effect/unstable/http"
|
|
23
|
+
import { layer as responsesLayer } from "@effect-uai/responses"
|
|
24
|
+
|
|
25
|
+
const provider = Layer.unwrap(
|
|
26
|
+
Effect.gen(function* () {
|
|
27
|
+
const apiKey = yield* Config.redacted("OPENAI_API_KEY")
|
|
28
|
+
return responsesLayer({ apiKey })
|
|
29
|
+
}),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
const layer = Layer.provide(provider, FetchHttpClient.layer)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The layer registers both the provider-typed `Responses` tag (for
|
|
36
|
+
provider-specific calls) and the generic `LanguageModel` tag (for
|
|
37
|
+
provider-agnostic loop bodies).
|
|
38
|
+
|
|
39
|
+
## Docs
|
|
40
|
+
|
|
41
|
+
<https://effect-uai.betalyra.com/providers/responses/>
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
MIT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll as t };
|