@fevex/openai 0.1.0-alpha.1 → 0.1.0-alpha.3

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/README.md CHANGED
@@ -37,10 +37,16 @@ run-local and must not be inspected. The adapter's `stateCodec` lets Fevex
37
37
  persist it only inside a private durable checkpoint.
38
38
 
39
39
  Core reasoning efforts are forwarded to `reasoning.effort`;
40
- `provider-default` leaves provider options untouched. Model-specific effort
41
- support remains an OpenAI capability and an unsupported value is reported by
42
- the API. Provider-only settings can be supplied through
43
- `modelOptions.reasoning`.
40
+ `provider-default` leaves provider options untouched. The core contract
41
+ includes `none`, `minimal`, `low`, `medium`, `high`, `xhigh` and `max` so
42
+ current GPT-5.6 models can use their documented effort levels. Model-specific
43
+ support still belongs to OpenAI, so an unsupported value is reported by the
44
+ API. Provider-only settings can be supplied through `modelOptions.reasoning`.
45
+
46
+ `createOpenAI` receives the connection settings (`apiKey`, optional
47
+ `organization`, `project`, `baseURL`, schema policy and `fetch`) and the model
48
+ ID is supplied when creating the gateway. Reasoning effort is intentionally a
49
+ per-request setting forwarded through `ModelInput`, not a factory setting.
44
50
 
45
51
  The adapter always uses the Responses streaming API. It emits only
46
52
  `response.output_text.delta` as visible output and builds the terminal result
package/dist/index.mjs CHANGED
@@ -533,6 +533,7 @@ function buildRequestBody(config, modelId, input) {
533
533
  input: toOpenAIInput(messages, readOpenAIProviderState(input.providerState, modelId)),
534
534
  ...input.tools?.length ? {
535
535
  tools: input.tools.map((tool) => toOpenAITool(tool, strict)),
536
+ ...toOpenAIToolChoice(input) === void 0 ? {} : { tool_choice: toOpenAIToolChoice(input) },
536
537
  parallel_tool_calls: false
537
538
  } : {},
538
539
  ...text === void 0 ? {} : { text },
@@ -540,6 +541,14 @@ function buildRequestBody(config, modelId, input) {
540
541
  ...maxOutputTokens === void 0 ? {} : { max_output_tokens: maxOutputTokens }
541
542
  };
542
543
  }
544
+ function toOpenAIToolChoice(input) {
545
+ if (!input.tools?.length || input.toolChoice === void 0 || input.toolChoice === "auto") return;
546
+ if (typeof input.toolChoice === "string") return input.toolChoice;
547
+ return {
548
+ type: "function",
549
+ name: input.toolChoice.name
550
+ };
551
+ }
543
552
  function toResponsesURL(baseURL) {
544
553
  return `${(baseURL ?? defaultBaseURL).replace(/\/$/, "")}/responses`;
545
554
  }
@@ -639,7 +648,9 @@ function assertCompatibleInput(input) {
639
648
  "minimal",
640
649
  "low",
641
650
  "medium",
642
- "high"
651
+ "high",
652
+ "xhigh",
653
+ "max"
643
654
  ].includes(input.reasoning)) throw new OpenAIError("OpenAI reasoning effort is invalid");
644
655
  if (input.outputSchema !== void 0 && !isRecord(input.outputSchema)) throw new OpenAIError("OpenAI outputSchema must be an object");
645
656
  if (input.tools !== void 0 && !Array.isArray(input.tools)) throw new OpenAIError("OpenAI tools must be an array");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fevex/openai",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.3",
4
4
  "description": "OpenAI ModelGateway adapter for Fevex.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -31,14 +31,14 @@
31
31
  "scripts": {
32
32
  "build": "tsdown src/index.ts --format esm --dts",
33
33
  "prepack": "bun run build",
34
- "test": "bun test src/index.test.ts",
34
+ "test": "bun test --cwd src",
35
35
  "typecheck": "tsc -p tsconfig.json --noEmit"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@fevex/core": "0.1.0-alpha.1"
41
+ "@fevex/core": "0.1.0-alpha.3"
42
42
  },
43
43
  "devDependencies": {
44
44
  "typescript": "^5.7.0"