Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add ldai package scaffolding #206

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report--ldai.md
Original file line number Diff line number Diff line change
@@ -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 [email protected].

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.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request--ldai.md
Original file line number Diff line number Diff line change
@@ -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.
38 changes: 38 additions & 0 deletions .github/workflows/ldai-ci.yml
Original file line number Diff line number Diff line change
@@ -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'
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 31 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
58 changes: 58 additions & 0 deletions ldai/README.md
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions ldai/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package ldai

type ServerSDK interface {
}

type Client struct {
sdk ServerSDK
}

func New(sdk ServerSDK) *Client {
return &Client{}
}
7 changes: 7 additions & 0 deletions ldai/client_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ldai

import "testing"

func TestNewClient(t *testing.T) {
_ = New(nil)
}
3 changes: 3 additions & 0 deletions ldai/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/launchdarkly/go-server-sdk/ldai

go 1.18
5 changes: 5 additions & 0 deletions ldai/package_info.go
Original file line number Diff line number Diff line change
@@ -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 }}
3 changes: 2 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"exclude-paths": [
".github",
".vscode",
"ldotel"
"ldotel",
"ldai"
]
},
"ldotel" : {
Expand Down
Loading