@effect/ai-openai 4.0.0-beta.78 → 4.0.0-beta.79
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/dist/OpenAiClient.d.ts.map +1 -1
- package/dist/OpenAiClient.js +6 -32
- package/dist/OpenAiClient.js.map +1 -1
- package/dist/OpenAiConfig.d.ts +3 -28
- package/dist/OpenAiConfig.d.ts.map +1 -1
- package/dist/OpenAiConfig.js +3 -28
- package/dist/OpenAiConfig.js.map +1 -1
- package/dist/OpenAiEmbeddingModel.d.ts +4 -28
- package/dist/OpenAiEmbeddingModel.d.ts.map +1 -1
- package/dist/OpenAiEmbeddingModel.js +4 -28
- package/dist/OpenAiEmbeddingModel.js.map +1 -1
- package/dist/OpenAiLanguageModel.d.ts +2 -30
- package/dist/OpenAiLanguageModel.d.ts.map +1 -1
- package/dist/OpenAiLanguageModel.js +2 -30
- package/dist/OpenAiLanguageModel.js.map +1 -1
- package/dist/OpenAiSchema.d.ts.map +1 -1
- package/dist/OpenAiSchema.js +0 -30
- package/dist/OpenAiSchema.js.map +1 -1
- package/dist/OpenAiTelemetry.d.ts.map +1 -1
- package/dist/OpenAiTelemetry.js +5 -22
- package/dist/OpenAiTelemetry.js.map +1 -1
- package/dist/OpenAiTool.d.ts +5 -23
- package/dist/OpenAiTool.d.ts.map +1 -1
- package/dist/OpenAiTool.js +5 -23
- package/dist/OpenAiTool.js.map +1 -1
- package/package.json +3 -3
- package/src/OpenAiClient.ts +6 -32
- package/src/OpenAiConfig.ts +3 -28
- package/src/OpenAiEmbeddingModel.ts +4 -28
- package/src/OpenAiLanguageModel.ts +2 -30
- package/src/OpenAiSchema.ts +0 -30
- package/src/OpenAiTelemetry.ts +5 -22
- package/src/OpenAiTool.ts +5 -23
package/dist/OpenAiTool.d.ts
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OpenAI provider
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* configuration arguments, provider call parameters, success output schema, and
|
|
8
|
-
* whether the tool call needs an application-provided handler.
|
|
9
|
-
*
|
|
10
|
-
* **Mental model**
|
|
11
|
-
*
|
|
12
|
-
* Provider-defined tools are not implementations of the capability themselves.
|
|
13
|
-
* They are schemas and metadata that tell the language model provider which
|
|
14
|
-
* tool to make available and tell Effect AI how to decode any tool calls or
|
|
15
|
-
* tool results that come back.
|
|
16
|
-
*
|
|
17
|
-
* **Common tasks**
|
|
18
|
-
*
|
|
19
|
-
* Use hosted or provider-routed tools such as {@link CodeInterpreter},
|
|
20
|
-
* {@link FileSearch}, {@link ImageGeneration}, {@link Mcp}, {@link WebSearch},
|
|
21
|
-
* and {@link WebSearchPreview} to opt into OpenAI-managed capabilities. Use
|
|
22
|
-
* handler-required tools such as {@link ApplyPatch}, {@link Shell}, and
|
|
23
|
-
* {@link LocalShell} only when your application is prepared to execute the
|
|
24
|
-
* requested local operation and enforce its own safety policy.
|
|
2
|
+
* The `OpenAiTool` module defines OpenAI provider tools for Effect AI language
|
|
3
|
+
* model requests. It exposes typed descriptors for tools such as Apply Patch,
|
|
4
|
+
* Code Interpreter, File Search, Image Generation, MCP, Web Search, and
|
|
5
|
+
* shell-like local tools, including their provider names, configuration
|
|
6
|
+
* arguments, call parameters, success schemas, and handler requirements.
|
|
25
7
|
*
|
|
26
8
|
* @since 4.0.0
|
|
27
9
|
*/
|
package/dist/OpenAiTool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAiTool.d.ts","sourceRoot":"","sources":["../src/OpenAiTool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"OpenAiTool.d.ts","sourceRoot":"","sources":["../src/OpenAiTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,IAAI,MAAM,yBAAyB,CAAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAgBpB,CAAA;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAY3B,CAAA"}
|
package/dist/OpenAiTool.js
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OpenAI provider
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* configuration arguments, provider call parameters, success output schema, and
|
|
8
|
-
* whether the tool call needs an application-provided handler.
|
|
9
|
-
*
|
|
10
|
-
* **Mental model**
|
|
11
|
-
*
|
|
12
|
-
* Provider-defined tools are not implementations of the capability themselves.
|
|
13
|
-
* They are schemas and metadata that tell the language model provider which
|
|
14
|
-
* tool to make available and tell Effect AI how to decode any tool calls or
|
|
15
|
-
* tool results that come back.
|
|
16
|
-
*
|
|
17
|
-
* **Common tasks**
|
|
18
|
-
*
|
|
19
|
-
* Use hosted or provider-routed tools such as {@link CodeInterpreter},
|
|
20
|
-
* {@link FileSearch}, {@link ImageGeneration}, {@link Mcp}, {@link WebSearch},
|
|
21
|
-
* and {@link WebSearchPreview} to opt into OpenAI-managed capabilities. Use
|
|
22
|
-
* handler-required tools such as {@link ApplyPatch}, {@link Shell}, and
|
|
23
|
-
* {@link LocalShell} only when your application is prepared to execute the
|
|
24
|
-
* requested local operation and enforce its own safety policy.
|
|
2
|
+
* The `OpenAiTool` module defines OpenAI provider tools for Effect AI language
|
|
3
|
+
* model requests. It exposes typed descriptors for tools such as Apply Patch,
|
|
4
|
+
* Code Interpreter, File Search, Image Generation, MCP, Web Search, and
|
|
5
|
+
* shell-like local tools, including their provider names, configuration
|
|
6
|
+
* arguments, call parameters, success schemas, and handler requirements.
|
|
25
7
|
*
|
|
26
8
|
* @since 4.0.0
|
|
27
9
|
*/
|
package/dist/OpenAiTool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAiTool.js","names":["Schema","Tool","Generated","ApplyPatch","providerDefined","id","customName","providerName","requiresHandler","parameters","Struct","call_id","ApplyPatchToolCall","fields","operation","success","status","ApplyPatchToolCallOutput","output","CodeInterpreter","args","container","CodeInterpreterTool","code","CodeInterpreterToolCall","container_id","outputs","FileSearch","filters","FileSearchTool","max_num_results","ranking_options","vector_store_ids","FileSearchToolCall","queries","results","ImageGeneration","background","ImageGenTool","input_fidelity","input_image_mask","model","moderation","output_compression","output_format","partial_images","quality","size","result","ImageGenToolCall","LocalShell","action","LocalShellToolCall","LocalShellToolCallOutput","Mcp","allowed_tools","MCPTool","authorization","connector_id","require_approval","server_description","server_label","server_url","Unknown","type","MCPToolCall","name","arguments","error","Shell","FunctionShellCall","FunctionShellCallOutput","WebSearch","WebSearchTool","user_location","search_context_size","WebSearchToolCall","WebSearchPreview","WebSearchPreviewTool"],"sources":["../src/OpenAiTool.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"OpenAiTool.js","names":["Schema","Tool","Generated","ApplyPatch","providerDefined","id","customName","providerName","requiresHandler","parameters","Struct","call_id","ApplyPatchToolCall","fields","operation","success","status","ApplyPatchToolCallOutput","output","CodeInterpreter","args","container","CodeInterpreterTool","code","CodeInterpreterToolCall","container_id","outputs","FileSearch","filters","FileSearchTool","max_num_results","ranking_options","vector_store_ids","FileSearchToolCall","queries","results","ImageGeneration","background","ImageGenTool","input_fidelity","input_image_mask","model","moderation","output_compression","output_format","partial_images","quality","size","result","ImageGenToolCall","LocalShell","action","LocalShellToolCall","LocalShellToolCallOutput","Mcp","allowed_tools","MCPTool","authorization","connector_id","require_approval","server_description","server_label","server_url","Unknown","type","MCPToolCall","name","arguments","error","Shell","FunctionShellCall","FunctionShellCallOutput","WebSearch","WebSearchTool","user_location","search_context_size","WebSearchToolCall","WebSearchPreview","WebSearchPreview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wB;EACpCC,YAAY,EAAE,oBAAoB;EAClCa,IAAI,eAAEpB,MAAM,CAACU,MAAM,CAAC;IAClBgE,aAAa,EAAExE,SAAS,CAAC4E,oBAAoB,CAACjE,MAAM,CAAC6D,aAAa;IAClEC,mBAAmB,EAAEzE,SAAS,CAAC4E,oBAAoB,CAACjE,MAAM,CAAC8D;GAC5D,CAAC;EACF5D,OAAO,eAAEf,MAAM,CAACU,MAAM,CAAC;IACrByC,MAAM,EAAEjD,SAAS,CAAC0E,iBAAiB,CAAC/D,MAAM,CAACsC,MAAM;IACjDnC,MAAM,EAAEd,SAAS,CAAC0E,iBAAiB,CAAC/D,MAAM,CAACG;GAC5C;CACF,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/ai-openai",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.79",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "An OpenAI provider integration for Effect AI SDK",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"provenance": true
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"effect": "^4.0.0-beta.
|
|
46
|
+
"effect": "^4.0.0-beta.79"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"effect": "^4.0.0-beta.
|
|
49
|
+
"effect": "^4.0.0-beta.79"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"codegen": "effect-utils codegen",
|
package/src/OpenAiClient.ts
CHANGED
|
@@ -1,36 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `OpenAiClient` module
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* and maps transport or decoding
|
|
7
|
-
*
|
|
8
|
-
* The service exposes a configured HTTP client plus helpers for non-streaming
|
|
9
|
-
* responses, server-sent event response streams, and embeddings. It also
|
|
10
|
-
* includes WebSocket mode for response streams when an application wants to use
|
|
11
|
-
* OpenAI's WebSocket transport instead of the default SSE path.
|
|
12
|
-
*
|
|
13
|
-
* **Common tasks**
|
|
14
|
-
*
|
|
15
|
-
* - Construct the service directly with {@link make}
|
|
16
|
-
* - Provide the service with {@link layer} or load settings from `Config` with
|
|
17
|
-
* {@link layerConfig}
|
|
18
|
-
* - Call `createResponse`, `createResponseStream`, or `createEmbedding` from
|
|
19
|
-
* code that depends on the `OpenAiClient` service
|
|
20
|
-
* - Enable WebSocket streaming around an effect with {@link withWebSocketMode}
|
|
21
|
-
* or through layers with {@link layerWebSocketMode}
|
|
22
|
-
*
|
|
23
|
-
* **Gotchas**
|
|
24
|
-
*
|
|
25
|
-
* - The default base URL is `https://api.openai.com/v1`; set `apiUrl` for
|
|
26
|
-
* proxies, local gateways, or compatible deployments.
|
|
27
|
-
* - A constructor `transformClient` is applied when the service is built, while
|
|
28
|
-
* scoped `OpenAiConfig` transforms are applied by request helpers when they
|
|
29
|
-
* run.
|
|
30
|
-
* - WebSocket mode requires a supported `Socket.WebSocketConstructor` layer and
|
|
31
|
-
* serializes response streams through the shared socket service.
|
|
32
|
-
* - This module is intentionally narrower than the generated OpenAI client; use
|
|
33
|
-
* `OpenAiClientGenerated` for direct access to generated endpoint helpers.
|
|
2
|
+
* The `OpenAiClient` module defines the low-level Effect service used by the
|
|
3
|
+
* OpenAI integration for Responses API and embedding requests. It builds a
|
|
4
|
+
* configured HTTP client with authentication and OpenAI organization or project
|
|
5
|
+
* headers, exposes helpers for non-streaming responses, SSE response streams,
|
|
6
|
+
* WebSocket response streams, and embeddings, and maps transport or decoding
|
|
7
|
+
* failures into `AiError`.
|
|
34
8
|
*
|
|
35
9
|
* @since 4.0.0
|
|
36
10
|
*/
|
package/src/OpenAiConfig.ts
CHANGED
|
@@ -1,34 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `OpenAiConfig` module
|
|
3
|
-
* `@effect/ai-openai`
|
|
4
|
-
*
|
|
2
|
+
* The `OpenAiConfig` module lets a workflow temporarily customize the HTTP
|
|
3
|
+
* client used by `@effect/ai-openai` request helpers. OpenAI client, language
|
|
4
|
+
* model, and embedding code read this scoped transform when they execute
|
|
5
5
|
* provider calls.
|
|
6
6
|
*
|
|
7
|
-
* **Mental model**
|
|
8
|
-
*
|
|
9
|
-
* Client constructors set the baseline HTTP client for an OpenAI service.
|
|
10
|
-
* `OpenAiConfig` is for narrower dynamic scopes: wrap an effect with
|
|
11
|
-
* {@link withClientTransform} and OpenAI requests evaluated inside that effect
|
|
12
|
-
* see the transformed `HttpClient`. Leaving the scope restores the previous
|
|
13
|
-
* configuration.
|
|
14
|
-
*
|
|
15
|
-
* **Common tasks**
|
|
16
|
-
*
|
|
17
|
-
* - Add request middleware, tracing, retry policy, proxy routing, or test
|
|
18
|
-
* interception around a group of OpenAI calls.
|
|
19
|
-
* - Apply a temporary HTTP client transform without rebuilding the OpenAI
|
|
20
|
-
* service layer.
|
|
21
|
-
* - Share one transform across all OpenAI helpers executed inside the same
|
|
22
|
-
* Effect scope.
|
|
23
|
-
*
|
|
24
|
-
* **Gotchas**
|
|
25
|
-
*
|
|
26
|
-
* - Only one `transformClient` value is stored in the scoped config. Compose
|
|
27
|
-
* transforms into a single `HttpClient => HttpClient` function when multiple
|
|
28
|
-
* behaviors should apply.
|
|
29
|
-
* - The transform affects OpenAI requests that read this contextual config; it
|
|
30
|
-
* does not mutate an already constructed HTTP client globally.
|
|
31
|
-
*
|
|
32
7
|
* @since 4.0.0
|
|
33
8
|
*/
|
|
34
9
|
import * as Context from "effect/Context"
|
|
@@ -1,33 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `OpenAiEmbeddingModel` module provides the OpenAI implementation of
|
|
3
|
-
* Effect AI's `EmbeddingModel` service. It
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* **Mental model**
|
|
8
|
-
*
|
|
9
|
-
* `OpenAiClient` owns transport, authentication, and provider request
|
|
10
|
-
* execution. This module owns embedding-specific configuration, response
|
|
11
|
-
* validation, and the `EmbeddingModel.EmbeddingModel` layer. Use {@link model}
|
|
12
|
-
* when you want an `AiModel` descriptor that also provides the configured
|
|
13
|
-
* embedding dimensions, or {@link layer} / {@link make} when the dimensions are
|
|
14
|
-
* managed separately.
|
|
15
|
-
*
|
|
16
|
-
* **Common tasks**
|
|
17
|
-
*
|
|
18
|
-
* - Provide an OpenAI-backed `EmbeddingModel.EmbeddingModel` from an existing
|
|
19
|
-
* `OpenAiClient`
|
|
20
|
-
* - Configure the OpenAI embedding model id, dimensions, encoding format, and
|
|
21
|
-
* other create-embedding request fields
|
|
22
|
-
* - Scope per-request defaults with {@link Config} and
|
|
23
|
-
* {@link withConfigOverride}
|
|
24
|
-
*
|
|
25
|
-
* **Gotchas**
|
|
26
|
-
*
|
|
27
|
-
* - The service expects OpenAI to return floating-point embedding arrays.
|
|
28
|
-
* Requesting base64 embeddings causes an `InvalidOutputError`.
|
|
29
|
-
* - Provider results are checked for missing, duplicate, or out-of-range
|
|
30
|
-
* indexes before they are exposed as Effect AI embedding results.
|
|
3
|
+
* Effect AI's `EmbeddingModel` service. It sends embedding requests through
|
|
4
|
+
* `OpenAiClient`, exposes constructors for layers and `AiModel` values,
|
|
5
|
+
* supports scoped request configuration overrides, and checks that OpenAI
|
|
6
|
+
* returns one numeric vector for each requested input.
|
|
31
7
|
*
|
|
32
8
|
* @since 4.0.0
|
|
33
9
|
*/
|
|
@@ -3,36 +3,8 @@
|
|
|
3
3
|
* implementation of Effect AI's `LanguageModel` service. It translates Effect
|
|
4
4
|
* AI prompts, files, tools, structured output requests, reasoning metadata, and
|
|
5
5
|
* provider options into OpenAI response requests, then converts OpenAI
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* **Mental model**
|
|
9
|
-
*
|
|
10
|
-
* `OpenAiClient` owns HTTP transport and provider calls. This module owns
|
|
11
|
-
* protocol translation: request assembly, tool choice conversion, structured
|
|
12
|
-
* output codecs, streaming event handling, response metadata, and GenAI
|
|
13
|
-
* telemetry annotations. {@link model}, {@link layer}, and {@link make} all
|
|
14
|
-
* build the same OpenAI-backed `LanguageModel.LanguageModel` service from a
|
|
15
|
-
* model id and optional request defaults.
|
|
16
|
-
*
|
|
17
|
-
* **Common tasks**
|
|
18
|
-
*
|
|
19
|
-
* - Provide an OpenAI-backed `LanguageModel.LanguageModel` from an existing
|
|
20
|
-
* `OpenAiClient`
|
|
21
|
-
* - Generate text or stream text through Effect AI's provider-neutral language
|
|
22
|
-
* model API
|
|
23
|
-
* - Use OpenAI provider metadata for files, reasoning items, tool calls, and
|
|
24
|
-
* response parts
|
|
25
|
-
* - Scope Responses API defaults with {@link Config} and
|
|
26
|
-
* {@link withConfigOverride}
|
|
27
|
-
*
|
|
28
|
-
* **Gotchas**
|
|
29
|
-
*
|
|
30
|
-
* - Some OpenAI model families receive system instructions as developer
|
|
31
|
-
* messages because the Responses API treats them differently.
|
|
32
|
-
* - File prompt parts are sent either as provider file ids or as base64
|
|
33
|
-
* content, depending on `fileIdPrefixes`.
|
|
34
|
-
* - Structured output and tool-call behavior depends on both Effect AI tool
|
|
35
|
-
* definitions and OpenAI model capabilities.
|
|
6
|
+
* non-streaming or streaming response results back into Effect AI response
|
|
7
|
+
* content and metadata.
|
|
36
8
|
*
|
|
37
9
|
* @since 4.0.0
|
|
38
10
|
*/
|
package/src/OpenAiSchema.ts
CHANGED
|
@@ -4,36 +4,6 @@
|
|
|
4
4
|
* the transport boundary for JSON sent to and decoded from the Responses and
|
|
5
5
|
* embeddings endpoints.
|
|
6
6
|
*
|
|
7
|
-
* **Mental model**
|
|
8
|
-
*
|
|
9
|
-
* - Request schemas such as {@link CreateResponse} and
|
|
10
|
-
* {@link CreateEmbeddingRequest} describe the encoded payloads sent to OpenAI.
|
|
11
|
-
* - Response schemas such as {@link Response}, {@link ResponseStreamEvent}, and
|
|
12
|
-
* {@link CreateEmbeddingResponse} describe provider data after schema
|
|
13
|
-
* decoding.
|
|
14
|
-
* - Shared schemas such as {@link InputItem}, {@link Tool}, and
|
|
15
|
-
* {@link TextResponseFormatConfiguration} cover the message, tool, and output
|
|
16
|
-
* format fragments reused across request and response shapes.
|
|
17
|
-
*
|
|
18
|
-
* **Common tasks**
|
|
19
|
-
*
|
|
20
|
-
* - Use {@link CreateResponse} with {@link Response} for non-streaming
|
|
21
|
-
* Responses API calls.
|
|
22
|
-
* - Use {@link ResponseStreamEvent} for server-sent events emitted by streaming
|
|
23
|
-
* Responses API calls.
|
|
24
|
-
* - Use {@link CreateEmbeddingRequest} and {@link CreateEmbeddingResponse} for
|
|
25
|
-
* embeddings endpoint payloads.
|
|
26
|
-
* - Use smaller schemas like {@link IncludeEnum}, {@link InputContent}, and
|
|
27
|
-
* {@link ToolChoice} when validating request fragments.
|
|
28
|
-
*
|
|
29
|
-
* **Gotchas**
|
|
30
|
-
*
|
|
31
|
-
* - The module models the subset of OpenAI shapes supported by this client
|
|
32
|
-
* path; it is not a complete mirror of every OpenAI REST API field.
|
|
33
|
-
* - Unknown future stream event types decode through
|
|
34
|
-
* {@link UnknownResponseStreamEvent}, while malformed known event types still
|
|
35
|
-
* fail schema decoding.
|
|
36
|
-
*
|
|
37
7
|
* @since 4.0.0
|
|
38
8
|
*/
|
|
39
9
|
import * as Effect from "effect/Effect"
|
package/src/OpenAiTelemetry.ts
CHANGED
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OpenAI-specific telemetry
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* OpenTelemetry span and you want to record both standard GenAI metadata and
|
|
8
|
-
* OpenAI details such as response format, requested service tier, actual
|
|
9
|
-
* service tier, or system fingerprint.
|
|
10
|
-
*
|
|
11
|
-
* **Mental model**
|
|
12
|
-
*
|
|
13
|
-
* The public option shape stays idiomatic TypeScript (`responseFormat`,
|
|
14
|
-
* `serviceTier`, `systemFingerprint`). When annotations are applied, the
|
|
15
|
-
* attributes are written to the span under OpenTelemetry semantic-convention
|
|
16
|
-
* keys such as `gen_ai.openai.request.response_format` and
|
|
17
|
-
* `gen_ai.openai.response.system_fingerprint`.
|
|
18
|
-
*
|
|
19
|
-
* **Gotchas**
|
|
20
|
-
*
|
|
21
|
-
* Annotation mutates the provided span in place. It does not create, end, or
|
|
22
|
-
* export spans, and OpenAI-specific attributes are only added when the
|
|
23
|
-
* `openai.request` or `openai.response` option objects are present.
|
|
2
|
+
* The `OpenAiTelemetry` module defines OpenAI-specific telemetry attributes
|
|
3
|
+
* and a helper for adding them to a tracing span. It keeps the standard GenAI
|
|
4
|
+
* telemetry attributes and adds request and response metadata, such as response
|
|
5
|
+
* format, service tier, and system fingerprint, under the `gen_ai.openai.*`
|
|
6
|
+
* OpenTelemetry namespaces.
|
|
24
7
|
*
|
|
25
8
|
* @since 4.0.0
|
|
26
9
|
*/
|
package/src/OpenAiTool.ts
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OpenAI provider
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* configuration arguments, provider call parameters, success output schema, and
|
|
8
|
-
* whether the tool call needs an application-provided handler.
|
|
9
|
-
*
|
|
10
|
-
* **Mental model**
|
|
11
|
-
*
|
|
12
|
-
* Provider-defined tools are not implementations of the capability themselves.
|
|
13
|
-
* They are schemas and metadata that tell the language model provider which
|
|
14
|
-
* tool to make available and tell Effect AI how to decode any tool calls or
|
|
15
|
-
* tool results that come back.
|
|
16
|
-
*
|
|
17
|
-
* **Common tasks**
|
|
18
|
-
*
|
|
19
|
-
* Use hosted or provider-routed tools such as {@link CodeInterpreter},
|
|
20
|
-
* {@link FileSearch}, {@link ImageGeneration}, {@link Mcp}, {@link WebSearch},
|
|
21
|
-
* and {@link WebSearchPreview} to opt into OpenAI-managed capabilities. Use
|
|
22
|
-
* handler-required tools such as {@link ApplyPatch}, {@link Shell}, and
|
|
23
|
-
* {@link LocalShell} only when your application is prepared to execute the
|
|
24
|
-
* requested local operation and enforce its own safety policy.
|
|
2
|
+
* The `OpenAiTool` module defines OpenAI provider tools for Effect AI language
|
|
3
|
+
* model requests. It exposes typed descriptors for tools such as Apply Patch,
|
|
4
|
+
* Code Interpreter, File Search, Image Generation, MCP, Web Search, and
|
|
5
|
+
* shell-like local tools, including their provider names, configuration
|
|
6
|
+
* arguments, call parameters, success schemas, and handler requirements.
|
|
25
7
|
*
|
|
26
8
|
* @since 4.0.0
|
|
27
9
|
*/
|