Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: launchdarkly/dotnet-core
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: LaunchDarkly.ServerSdk.Ai-v0.5.0
Choose a base ref
...
head repository: launchdarkly/dotnet-core
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: LaunchDarkly.ServerSdk.Ai-v0.6.0
Choose a head ref
  • 2 commits
  • 13 files changed
  • 4 contributors

Commits on Jan 28, 2025

  1. feat: track TimeToFirstToken in LdAiConfigTracker (#67)

    Co-authored-by: Matthew M. Keeler <[email protected]>
    Co-authored-by: Todd Anderson <[email protected]>
    3 people authored Jan 28, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    875dba5 View commit details
  2. chore(main): release LaunchDarkly.ServerSdk.Ai 0.6.0 (#69)

    🤖 I have created a release *beep* *boop*
    ---
    
    
    ##
    [0.6.0](LaunchDarkly.ServerSdk.Ai-v0.5.0...LaunchDarkly.ServerSdk.Ai-v0.6.0)
    (2025-01-28)
    
    
    ### Features
    
    * track TimeToFirstToken in LdAiConfigTracker
    ([#67](#67))
    ([875dba5](875dba5))
    
    ---
    This PR was generated with [Release
    Please](https://github.com/googleapis/release-please). See
    [documentation](https://github.com/googleapis/release-please#release-please).
    
    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    github-actions[bot] authored Jan 28, 2025
    Copy the full SHA
    0bb6ab9 View commit details
2 changes: 1 addition & 1 deletion .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ on:
name: Publish Docs
jobs:
build-publish:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: write
8 changes: 4 additions & 4 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ on:

jobs:
release-please:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

outputs:
package-sdk-server-released: ${{ steps.release.outputs['pkgs/sdk/server--release_created'] }}
@@ -28,7 +28,7 @@ jobs:
target-branch: ${{ github.ref_name }}

release-sdk-server:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: release-please
permissions:
id-token: write
@@ -57,7 +57,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

release-sdk-server-ai:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: release-please
permissions:
id-token: write
@@ -86,7 +86,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

release-telemetry:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: release-please
permissions:
id-token: write
2 changes: 1 addition & 1 deletion .github/workflows/release-sdk-client.yml
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ jobs:

# Signing DLLs is done on Ubuntu due to Digicert tooling compatibility
sign-dlls:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: build
permissions:
id-token: write
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: write
2 changes: 1 addition & 1 deletion .github/workflows/sdk-server-ai-ci.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:
build-and-test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-22.04, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
permissions:
2 changes: 1 addition & 1 deletion .github/workflows/sdk-server-ci.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:
build-and-test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-22.04, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
permissions:
2 changes: 1 addition & 1 deletion .github/workflows/telemetry-ci.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:
build-and-test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-22.04, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
permissions:
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -2,5 +2,5 @@
"pkgs/sdk/server": "8.6.0",
"pkgs/sdk/client": "5.3.0",
"pkgs/telemetry": "1.0.0",
"pkgs/sdk/server-ai": "0.5.0"
"pkgs/sdk/server-ai": "0.6.0"
}
7 changes: 7 additions & 0 deletions pkgs/sdk/server-ai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.6.0](https://github.com/launchdarkly/dotnet-core/compare/LaunchDarkly.ServerSdk.Ai-v0.5.0...LaunchDarkly.ServerSdk.Ai-v0.6.0) (2025-01-28)


### Features

* track TimeToFirstToken in LdAiConfigTracker ([#67](https://github.com/launchdarkly/dotnet-core/issues/67)) ([875dba5](https://github.com/launchdarkly/dotnet-core/commit/875dba5bc398085d3569a1f78f0039c81916217b))

## [0.5.0](https://github.com/launchdarkly/dotnet-core/compare/LaunchDarkly.ServerSdk.Ai-v0.4.0...LaunchDarkly.ServerSdk.Ai-v0.5.0) (2024-12-17)


6 changes: 6 additions & 0 deletions pkgs/sdk/server-ai/src/Interfaces/ILdAiConfigTracker.cs
Original file line number Diff line number Diff line change
@@ -36,6 +36,12 @@ public interface ILdAiConfigTracker
/// <typeparam name="T">type of the task's result</typeparam>
/// <returns>the task</returns>
public Task<T> TrackDurationOfTask<T>(Task<T> task);

/// <summary>
/// Tracks the time it takes for the first token to be generated.
/// </summary>
/// <param name="timeToFirstTokenMs">the duration in milliseconds</param>
public void TrackTimeToFirstToken(float timeToFirstTokenMs);

/// <summary>
/// Tracks feedback (positive or negative) related to the output of the model.
2 changes: 1 addition & 1 deletion pkgs/sdk/server-ai/src/LaunchDarkly.ServerSdk.Ai.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!--x-release-please-start-version-->
<Version>0.5.0</Version>
<Version>0.6.0</Version>
<!--x-release-please-end-->
<!-- The BUILDFRAMEWORKS variable allows us to override the target frameworks with a
single framework that we are testing; this allows us to test with older SDK
5 changes: 5 additions & 0 deletions pkgs/sdk/server-ai/src/LdAiConfigTracker.cs
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ public class LdAiConfigTracker : ILdAiConfigTracker
private const string TokenTotal = "$ld:ai:tokens:total";
private const string TokenInput = "$ld:ai:tokens:input";
private const string TokenOutput = "$ld:ai:tokens:output";
private const string TimeToFirstToken = "$ld:ai:tokens:ttf";

/// <summary>
/// Constructs a new AI configuration tracker. The tracker is associated with a configuration,
@@ -69,6 +70,10 @@ public async Task<T> TrackDurationOfTask<T>(Task<T> task)
TrackDuration(sw.ElapsedMilliseconds);
}
}

/// <inheritdoc/>
public void TrackTimeToFirstToken(float timeToFirstTokenMs) =>
_client.Track(TimeToFirstToken, _context, _trackData, timeToFirstTokenMs);

/// <inheritdoc/>
public void TrackFeedback(Feedback feedback)
17 changes: 17 additions & 0 deletions pkgs/sdk/server-ai/test/LdAiConfigTrackerTest.cs
Original file line number Diff line number Diff line change
@@ -51,6 +51,23 @@ public void CanTrackDuration()
mockClient.Verify(x => x.Track("$ld:ai:duration:total", context, data, 1.0f), Times.Once);
}

[Fact]
public void CanTrackTimeToFirstToken()
{
var mockClient = new Mock<ILaunchDarklyClient>();
var context = Context.New("key");
const string flagKey = "key";
var config = LdAiConfig.Disabled;
var data = LdValue.ObjectFrom(new Dictionary<string, LdValue>
{
{ "variationKey", LdValue.Of(config.VariationKey) },
{ "configKey", LdValue.Of(flagKey) }
});
var tracker = new LdAiConfigTracker(mockClient.Object, flagKey, config, context);

tracker.TrackTimeToFirstToken(1.0f);
mockClient.Verify(x => x.Track("$ld:ai:tokens:ttf", context, data, 1.0f), Times.Once);
}

[Fact]
public void CanTrackSuccess()