diff --git a/.github/ISSUE_TEMPLATE/bug_report--ldai.md b/.github/ISSUE_TEMPLATE/bug_report--ldai.md new file mode 100644 index 00000000..f711d2e8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report--ldai.md @@ -0,0 +1,37 @@ +--- +name: Bug report for the ldai module +about: Create a report to help us improve +title: '' +labels: 'ldai, enhancement' +assignees: '' + +--- + +**Is this a support request?** +This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to the SDK, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going [here](https://support.launchdarkly.com/hc/en-us/requests/new) or by emailing support@launchdarkly.com. + +Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above. + +**Describe the bug** +A clear and concise description of what the bug is. + +**To reproduce** +Steps to reproduce the behavior. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Logs** +If applicable, add any log output related to your problem. + +**SDK version** +The version of this SDK that you are using. + +**Language version, developer tools** +For instance, Go 1.22. + +**OS/platform** +For instance, Ubuntu 16.04, or Windows 10. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request--ldai.md b/.github/ISSUE_TEMPLATE/feature_request--ldai.md new file mode 100644 index 00000000..65733fc8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request--ldai.md @@ -0,0 +1,20 @@ +--- +name: Feature request for the ldai module +about: Suggest an idea for this project +title: '' +labels: 'ldai, enhancement' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context about the feature request here. diff --git a/.github/workflows/ldai-ci.yml b/.github/workflows/ldai-ci.yml new file mode 100644 index 00000000..f5f1ed2d --- /dev/null +++ b/.github/workflows/ldai-ci.yml @@ -0,0 +1,38 @@ +name: Build and Test ldai +on: + push: + branches: [ 'v7', 'feat/**' ] + paths-ignore: + - '**.md' # Don't run CI on markdown changes. + pull_request: + branches: [ 'v7', 'feat/**' ] + paths-ignore: + - '**.md' + +jobs: + go-versions: + uses: ./.github/workflows/go-versions.yml + + # Runs the common tasks (unit tests, lint, contract tests) for each Go version. + test-linux: + name: ${{ format('ldai Linux, Go {0}', matrix.go-version) }} + needs: go-versions + strategy: + # Let jobs fail independently, in case it's a single version that's broken. + fail-fast: false + matrix: + go-version: ${{ fromJSON(needs.go-versions.outputs.matrix) }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Go ${{ inputs.go-version }} + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + - uses: ./.github/actions/unit-tests + with: + lint: 'true' + test-target: ldai-test + - uses: ./.github/actions/coverage + with: + enforce: 'false' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6e159f65..97db16fe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ The SDK is tested against three Go versions: the latest, penultimate, and a mini Whereas the latest and penultimate are updates on a regular cadence to track upstream Go releases, the minimum version may be bumped at the discretion of the SDK maintainers to take advantage of new features. -Invoke the following make command, which will update `go.mod`, `ldotel/go.mod`, `testservice/go.mod`, and +Invoke the following make command, which will update `go.mod`, `ldotel/go.mod`, `ldai/go.mod`, `testservice/go.mod`, and `.github/variables/go-versions.env` (pass the desired Go version): ```shell make bump-min-go-version MIN_GO_VERSION=1.18 diff --git a/Makefile b/Makefile index ed2da19b..063c2aba 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ COVERAGE_ENFORCER_FLAGS=-package github.com/launchdarkly/go-server-sdk/v7 \ -skipcode "// COVERAGE" \ -packagestats -filestats -showcode -ALL_BUILD_TARGETS=sdk ldotel +ALL_BUILD_TARGETS=sdk ldotel ldai ALL_TEST_TARGETS = $(addsuffix -test, $(ALL_BUILD_TARGETS)) ALL_LINT_TARGETS = $(addsuffix -lint, $(ALL_BUILD_TARGETS)) @@ -35,6 +35,7 @@ test: $(ALL_TEST_TARGETS) bump-min-go-version: go mod edit -go=$(MIN_GO_VERSION) go.mod cd ldotel && go mod edit -go=$(MIN_GO_VERSION) go.mod + cd ldai && go mod edit -go=$(MIN_GO_VERSION) go.mod cd testservice && go mod edit -go=$(MIN_GO_VERSION) go.mod cd ./.github/variables && sed -i.bak "s#min=[^ ]*#min=$(MIN_GO_VERSION)#g" go-versions.env && rm go-versions.env.bak @@ -81,6 +82,34 @@ ldotel-lint: cd ldotel && $(LINTER) run .; \ fi +ldai: + @if [ -f go.work ]; then \ + echo "Building ldai with workspace" \ + go build ./ldai; \ + else \ + echo "Building ldai without workspace" \ + cd ldai && go build .; \ + fi + +ldai-test: + @if [ -f go.work ]; then \ + echo "Testing ldai with workspace" \ + go test -v -race ./ldai; \ + else \ + echo "Testing ldai without workspace" \ + cd ldai && go test -v -race .; \ + fi + +ldai-lint: + @if [ -f go.work ]; then \ + echo "Linting ldai with workspace" \ + $(LINTER) run ./ldai; \ + else \ + echo "Linting ldai without workspace" \ + cd ldai && $(LINTER) run .; \ + fi + + test-coverage: $(COVERAGE_PROFILE_RAW) go run github.com/launchdarkly-labs/go-coverage-enforcer@latest $(COVERAGE_ENFORCER_FLAGS) -outprofile $(COVERAGE_PROFILE_FILTERED) $(COVERAGE_PROFILE_RAW) go tool cover -html $(COVERAGE_PROFILE_FILTERED) -o $(COVERAGE_PROFILE_FILTERED_HTML) @@ -127,6 +156,7 @@ workspace: go.work go.work: go work init ./ go work use ./ldotel + go work use ./ldai go work use ./testservice workspace-clean: diff --git a/ldai/README.md b/ldai/README.md new file mode 100644 index 00000000..428f2b4f --- /dev/null +++ b/ldai/README.md @@ -0,0 +1,58 @@ +LaunchDarkly Server-side AI SDK for Go +============================================== +[![Actions Status](https://github.com/launchdarkly/go-server-sdk/actions/workflows/ldoai-ci.yml/badge.svg?branch=v7)](https://github.com/launchdarkly/go-server-sdk/actions/workflows/ldai-ci.yml) + +LaunchDarkly overview +------------------------- +[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves trillions of feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/home/getting-started) using LaunchDarkly today! + +[![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly) + +Getting started +----------- + +Import the module: + +```go +import ( + ld "github.com/launchdarkly/go-server-sdk/v7" + "github.com/launchdarkly/go-server-sdk/ldai" +) +``` + +Configure the base LaunchDarkly client: + +```go +client, _ = ld.MakeClient("your-sdk-key", 5*time.Second) +``` + +Instantiate the AI client: +```go + +aiClient := ldai.New(client) +``` + +Learn more +----------- + +Read our [documentation](http://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. + +Contributing +------------ + +We encourage pull requests and other contributions from the community. Check out our [contributing guidelines](CONTRIBUTING.md) for instructions on how to contribute to this library. + +About LaunchDarkly +----------- + +* LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can: + * Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases. + * Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?). + * Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file. + * Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline. +* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read [our documentation](https://docs.launchdarkly.com/sdk) for a complete list. +* Explore LaunchDarkly + * [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information + * [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides + * [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation + * [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates diff --git a/ldai/client.go b/ldai/client.go new file mode 100644 index 00000000..6d699185 --- /dev/null +++ b/ldai/client.go @@ -0,0 +1,12 @@ +package ldai + +type ServerSDK interface { +} + +type Client struct { + sdk ServerSDK +} + +func New(sdk ServerSDK) *Client { + return &Client{} +} diff --git a/ldai/client_test.go b/ldai/client_test.go new file mode 100644 index 00000000..e29a8fe8 --- /dev/null +++ b/ldai/client_test.go @@ -0,0 +1,7 @@ +package ldai + +import "testing" + +func TestNewClient(t *testing.T) { + _ = New(nil) +} diff --git a/ldai/go.mod b/ldai/go.mod new file mode 100644 index 00000000..08aa0707 --- /dev/null +++ b/ldai/go.mod @@ -0,0 +1,3 @@ +module github.com/launchdarkly/go-server-sdk/ldai + +go 1.18 diff --git a/ldai/package_info.go b/ldai/package_info.go new file mode 100644 index 00000000..86ff50dd --- /dev/null +++ b/ldai/package_info.go @@ -0,0 +1,5 @@ +// Package ldai contains an AI SDK suitable for usage with generative AI applications. +package ldai + +// Version is the current version string of the ldai package. This is updated by our release scripts. +const Version = "0.0.0" // {{ x-release-please-version }} diff --git a/release-please-config.json b/release-please-config.json index d4169991..42becb05 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -14,7 +14,8 @@ "exclude-paths": [ ".github", ".vscode", - "ldotel" + "ldotel", + "ldai" ] }, "ldotel" : {