Skip to content
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
56 changes: 56 additions & 0 deletions .github/workflows/ai.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# auto-generated by scripts/builds. DO NOT EDIT.
name: ai

on:
push:
branches:
- main
pull_request:
paths:
- ai/**
- .github/workflows/ai.yml

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./ai
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./ai/go.mod
cache: true
cache-dependency-path: ./ai/go.sum
- run: go build -v ./...
- run: go test -race -v ./...

dependabot:
needs: [build]
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}}
steps:
- id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- run: |
gh pr review --approve "$PR_URL"
gh pr merge --squash --auto "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

lint:
uses: charmbracelet/meta/.github/workflows/lint.yml@main
with:
directory: ./ai/...
golangci_path: .golangci.yml

56 changes: 56 additions & 0 deletions .github/workflows/anthropic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# auto-generated by scripts/builds. DO NOT EDIT.
name: anthropic

on:
push:
branches:
- main
pull_request:
paths:
- providers/anthropic/**
- .github/workflows/anthropic.yml

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./providers/anthropic
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./providers/anthropic/go.mod
cache: true
cache-dependency-path: ./providers/anthropic/go.sum
- run: go build -v ./...
- run: go test -race -v ./...

dependabot:
needs: [build]
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}}
steps:
- id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- run: |
gh pr review --approve "$PR_URL"
gh pr merge --squash --auto "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

lint:
uses: charmbracelet/meta/.github/workflows/lint.yml@main
with:
directory: ./providers/anthropic/...
golangci_path: .golangci.yml

11 changes: 0 additions & 11 deletions .github/workflows/build.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# auto-generated by scripts/builds. DO NOT EDIT.
name: examples

on:
push:
branches:
- main
pull_request:
paths:
- examples/**
- .github/workflows/examples.yml

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./examples
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./examples/go.mod
cache: true
cache-dependency-path: ./examples/go.sum
- run: go build -v ./...
- run: go test -race -v ./...

dependabot:
needs: [build]
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}}
steps:
- id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- run: |
gh pr review --approve "$PR_URL"
gh pr merge --squash --auto "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

lint:
uses: charmbracelet/meta/.github/workflows/lint.yml@main
with:
directory: ./examples/...
golangci_path: .golangci.yml

11 changes: 0 additions & 11 deletions .github/workflows/lint.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/openai.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# auto-generated by scripts/builds. DO NOT EDIT.
name: openai

on:
push:
branches:
- main
pull_request:
paths:
- providers/openai/**
- .github/workflows/openai.yml

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./providers/openai
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./providers/openai/go.mod
cache: true
cache-dependency-path: ./providers/openai/go.sum
- run: go build -v ./...
- run: go test -race -v ./...

dependabot:
needs: [build]
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}}
steps:
- id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- run: |
gh pr review --approve "$PR_URL"
gh pr merge --squash --auto "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

lint:
uses: charmbracelet/meta/.github/workflows/lint.yml@main
with:
directory: ./providers/openai/...
golangci_path: .golangci.yml

4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
# Dependency directories (remove the comment below to include it)
vendor/

# Go workspace file
go.work
go.work.sum

# IDE specific files
.idea/
.vscode/
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ linters:
# - exhaustive
# - goconst
- godot
- gomoddirectives
# - gomoddirectives
- goprintffuncname
- gosec
- misspell
Expand Down
37 changes: 25 additions & 12 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
version: '3'

env:
GOPRIVATE: github.com/charmbracelet/*

vars:
PACKAGES:
- ./ai
- ./examples
- ./providers/anthropic
- ./providers/openai

tasks:
test:
desc: Run tests
fmt:
desc: Run gofumpt for all packages
cmds:
- go test ./...
- for: { var: PACKAGES }
cmd: cd {{.ITEM}} && gofmt -s -w .

lint:
desc: Run linters
modernize:
desc: Run modernize for all packages
cmds:
- golangci-lint run --config .golangci.yml --timeout 10m
- for: { var: PACKAGES }
cmd: cd {{.ITEM}} && modernize -fix ./...

lint:fix:
desc: Fix lint issues
lint:
desc: Run base linters for all packages
cmds:
- golangci-lint run --config .golangci.yml --fix
- for: { var: PACKAGES }
cmd: cd {{.ITEM}} && golangci-lint run

fmt:
desc: Format code
test:
desc: Run tests for all packages
cmds:
- gofumpt -w .
- for: { var: PACKAGES }
cmd: cd {{.ITEM}} && go test ./... {{.CLI_ARGS}}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions ai/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module github.com/charmbracelet/ai/ai

go 1.24.5

require (
github.com/go-viper/mapstructure/v2 v2.4.0
github.com/stretchr/testify v1.11.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
12 changes: 12 additions & 0 deletions ai/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"os"

"github.com/charmbracelet/ai"
"github.com/charmbracelet/ai/ai"
"github.com/charmbracelet/ai/providers/openai"
)

Expand Down
26 changes: 26 additions & 0 deletions examples/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module github.com/charmbracelet/ai/examples

go 1.24.5

require (
github.com/charmbracelet/ai/ai v0.0.0-00010101000000-000000000000
github.com/charmbracelet/ai/providers/anthropic v0.0.0-00010101000000-000000000000
github.com/charmbracelet/ai/providers/openai v0.0.0-00010101000000-000000000000
)

require (
github.com/anthropics/anthropic-sdk-go v1.10.0 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/openai/openai-go/v2 v2.2.1 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
)

replace github.com/charmbracelet/ai/ai => ../ai

replace github.com/charmbracelet/ai/providers/anthropic => ../providers/anthropic

replace github.com/charmbracelet/ai/providers/openai => ../providers/openai
Loading
Loading