Skip to content

Conversation

@jsonbailey
Copy link
Contributor

@jsonbailey jsonbailey commented Oct 24, 2025

Note

Convert defaults to LD flag values (with _ldMeta.enabled) before calling variation, so configs/agents respect default enabled; update tests accordingly.

  • Server AI SDK:
    • Default handling: Add _toLDFlagValue to convert defaultValue into LD flag shape with _ldMeta.enabled, and use it in _evaluate so enabled mirrors the provided default when no flag metadata is present.
    • Refactor: Rename local provider to configProvider in agent/config assembly to avoid shadowing.
  • Tests:
    • Update expectations to assert enabled equals the provided default and that variation is called with the LD-shaped default (including _ldMeta.enabled).
    • Adjust mocks for both config and agent paths to return LD-shaped values.

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

@jsonbailey jsonbailey requested a review from a team as a code owner October 24, 2025 21:00
@github-actions
Copy link
Contributor

@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

@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

@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

@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

context,
defaultValue,
);
const {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just a consistency formatting change to align with how we format in the config method.

provider: defaultValue.provider,
instructions: 'instructions' in defaultValue ? defaultValue.instructions : undefined,
};
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be static. Does it need to be defined on LDAIClientImpl?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this would be defined in api/config as a utility method but this could create a circular dependency. I wanted to avoid any breaking changes to the SDK for this.

Current flow:

  • api/agents → imports from api/config (line 1 in LDAIAgent.ts)
  • api/config → would need to import from api/agents (for LDAIAgentDefaults)

This creates a cycle:

  • api/agents → api/config → api/agents ❌

@jsonbailey jsonbailey merged commit 30e2305 into main Oct 24, 2025
32 checks passed
@jsonbailey jsonbailey deleted the jb/sdk-1514/fix-ai-defaults branch October 24, 2025 22:05
@github-actions github-actions bot mentioned this pull request Oct 24, 2025
jsonbailey added a commit that referenced this pull request Oct 27, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>server-sdk-ai: 0.12.3</summary>

##
[0.12.3](server-sdk-ai-v0.12.2...server-sdk-ai-v0.12.3)
(2025-10-24)


### Bug Fixes

* Fix default configs always being disabled
([#965](#965))
([30e2305](30e2305))
</details>

<details><summary>server-sdk-ai-langchain: 0.1.3</summary>

##
[0.1.3](server-sdk-ai-langchain-v0.1.2...server-sdk-ai-langchain-v0.1.3)
(2025-10-24)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/server-sdk-ai bumped from ^0.12.2 to ^0.12.3
  * peerDependencies
    * @launchdarkly/server-sdk-ai bumped from ^0.12.2 to ^0.12.3
</details>

<details><summary>server-sdk-ai-openai: 0.1.2</summary>

##
[0.1.2](server-sdk-ai-openai-v0.1.1...server-sdk-ai-openai-v0.1.2)
(2025-10-24)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/server-sdk-ai bumped from ^0.12.2 to ^0.12.3
  * peerDependencies
    * @launchdarkly/server-sdk-ai bumped from ^0.12.2 to ^0.12.3
</details>

<details><summary>server-sdk-ai-vercel: 0.1.2</summary>

##
[0.1.2](server-sdk-ai-vercel-v0.1.1...server-sdk-ai-vercel-v0.1.2)
(2025-10-24)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/server-sdk-ai bumped from ^0.12.2 to ^0.12.3
  * peerDependencies
    * @launchdarkly/server-sdk-ai bumped from ^0.12.2 to ^0.12.3
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Release server-ai 0.12.3 with a bug fix and bump provider packages and
example apps to use it.
> 
> - **AI SDK (`packages/sdk/server-ai`)**:
> - Release `0.12.3` with bug fix: default configs no longer always
disabled (`CHANGELOG.md`).
> - **AI Providers**:
> - Bump versions and align dev deps to
`@launchdarkly/server-sdk-ai@^0.12.3`:
>     - `server-ai-langchain` → `0.1.3`
>     - `server-ai-openai` → `0.1.2`
>     - `server-ai-vercel` → `0.1.2`
>   - Update corresponding `CHANGELOG.md` entries.
> - **Examples**:
> - Update `@launchdarkly/server-sdk-ai` dependency to `0.12.3` in
`examples/bedrock`, `examples/openai`, `examples/tracked-chat`,
`examples/vercel-ai`.
> - **Release Manifest**:
>   - Update versions in `.release-please-manifest.json`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
0f97709. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jason Bailey <jbailey@launchdarkly.com>
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