Skip to content

Conversation

@jsonbailey
Copy link
Contributor

@jsonbailey jsonbailey commented Nov 5, 2025

Note

Adds structured-output invokeStructuredModel with JSON schema parsing and metrics, and hardens invokeModel with try/catch and empty-content handling; comprehensive tests included.

  • Server OpenAI Provider (src/OpenAIProvider.ts):
    • Structured Output: New invokeStructuredModel(messages, responseStructure) using response_format: json_schema, parses JSON payload, returns data, rawResponse, and metrics; handles missing content, JSON parse failures, and API errors with logging.
    • invokeModel: Wrapped in try/catch; derives metrics early; warns and marks failure on empty content.
    • Import StructuredResponse type.
  • Tests (__tests__/OpenAIProvider.test.ts):
    • Add tests for invokeStructuredModel success, missing content, invalid JSON, and empty choices.
    • Extend invokeModel tests for empty/missing choices and metrics expectations.

Written by Cursor Bugbot for commit 5a3cffe. This will update automatically on new commits. Configure here.

@jsonbailey jsonbailey requested a review from a team as a code owner November 5, 2025 14:09
@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 169118 bytes
Compressed size limit: 200000
Uncompressed size: 789399 bytes

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 24988 bytes
Compressed size limit: 26000
Uncompressed size: 122411 bytes

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 17636 bytes
Compressed size limit: 20000
Uncompressed size: 90259 bytes

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 21721 bytes
Compressed size limit: 25000
Uncompressed size: 74698 bytes

@jsonbailey jsonbailey changed the title feat! : Support invoke with structured output in OpenAI provider feat!: Support invoke with structured output in OpenAI provider Nov 5, 2025
@tanderson-ld tanderson-ld self-requested a review November 5, 2025 20:52
@jsonbailey jsonbailey merged commit 515dbdf into main Nov 5, 2025
32 checks passed
@jsonbailey jsonbailey deleted the jb/sdk-1523/structed-model-provider-openai branch November 5, 2025 21:17
@github-actions github-actions bot mentioned this pull request Nov 5, 2025
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