From fb35cdfdf1472b0f321e0b16fa088c77564cbc4d Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Wed, 3 Sep 2025 14:11:46 -0300 Subject: [PATCH] refactor: revert o use a single go module again I experimented with multiple Go modules, but the fact is that Go is smart enough to strip out the uneeded modules from the user's `go.mod`, so this is not in fact needed. Also, maintaining a single module is much easier. --- .github/workflows/ai.yml | 56 -------------------------- .github/workflows/anthropic.yml | 56 -------------------------- .github/workflows/build.yml | 11 +++++ .github/workflows/examples.yml | 56 -------------------------- .github/workflows/lint.yml | 11 +++++ .github/workflows/openai.yml | 56 -------------------------- Taskfile.yaml | 22 ++-------- ai/go.mod | 14 ------- ai/go.sum | 12 ------ anthropic/go.mod | 18 --------- anthropic/go.sum | 22 ---------- examples/go.mod | 26 ------------ examples/go.sum | 26 ------------ openai/go.mod => go.mod | 10 ++--- openai/go.sum => go.sum | 6 ++- go.work | 8 ---- go.work.sum | 50 ----------------------- scripts/generate_ci | 71 --------------------------------- 18 files changed, 34 insertions(+), 497 deletions(-) delete mode 100644 .github/workflows/ai.yml delete mode 100644 .github/workflows/anthropic.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/examples.yml create mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/openai.yml delete mode 100644 ai/go.mod delete mode 100644 ai/go.sum delete mode 100644 anthropic/go.mod delete mode 100644 anthropic/go.sum delete mode 100644 examples/go.mod delete mode 100644 examples/go.sum rename openai/go.mod => go.mod (62%) rename openai/go.sum => go.sum (85%) delete mode 100644 go.work delete mode 100644 go.work.sum delete mode 100755 scripts/generate_ci diff --git a/.github/workflows/ai.yml b/.github/workflows/ai.yml deleted file mode 100644 index 1455e8b69467a03fd1c17baeb18e28fb7eab6808..0000000000000000000000000000000000000000 --- a/.github/workflows/ai.yml +++ /dev/null @@ -1,56 +0,0 @@ -# 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 - diff --git a/.github/workflows/anthropic.yml b/.github/workflows/anthropic.yml deleted file mode 100644 index 94a96d78f6d70162c8bd598ceb8867571d746644..0000000000000000000000000000000000000000 --- a/.github/workflows/anthropic.yml +++ /dev/null @@ -1,56 +0,0 @@ -# auto-generated by scripts/builds. DO NOT EDIT. -name: anthropic - -on: - push: - branches: - - main - pull_request: - paths: - - anthropic/** - - .github/workflows/anthropic.yml - -jobs: - build: - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - defaults: - run: - working-directory: ./anthropic - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version-file: ./anthropic/go.mod - cache: true - cache-dependency-path: ./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: ./anthropic/... - golangci_path: .golangci.yml - diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000000000000000000000000000000000..3511f7fe0c4f487eb3fc9009795361ada8e2eff7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,11 @@ +name: build +on: [push, pull_request] + +jobs: + build: + uses: charmbracelet/meta/.github/workflows/build.yml@main + with: + go-version: "" + go-version-file: ./go.mod + secrets: + gh_pat: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 273aa481f0d0b27c0295ab8ad54334c6e43b54f3..0000000000000000000000000000000000000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,56 +0,0 @@ -# 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 - diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000000000000000000000000000000000..1ffad5f2f7da7042b6a2217043b48aefeb5a68ff --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,11 @@ +name: lint +on: + push: + pull_request: + +jobs: + lint: + uses: charmbracelet/meta/.github/workflows/lint.yml@main + with: + golangci_path: .golangci.yml + timeout: 10m diff --git a/.github/workflows/openai.yml b/.github/workflows/openai.yml deleted file mode 100644 index 1276fe922aa9b43d2283905e1f8b0586b42ad12e..0000000000000000000000000000000000000000 --- a/.github/workflows/openai.yml +++ /dev/null @@ -1,56 +0,0 @@ -# auto-generated by scripts/builds. DO NOT EDIT. -name: openai - -on: - push: - branches: - - main - pull_request: - paths: - - openai/** - - .github/workflows/openai.yml - -jobs: - build: - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - defaults: - run: - working-directory: ./openai - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version-file: ./openai/go.mod - cache: true - cache-dependency-path: ./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: ./openai/... - golangci_path: .golangci.yml - diff --git a/Taskfile.yaml b/Taskfile.yaml index 03be3c9f73cba310bb424e18e67629d226915a66..cd98cbdf4cb3ce942d2a9fffe4869270f03f0420 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -1,36 +1,22 @@ version: '3' -env: - GOPRIVATE: github.com/charmbracelet/* - -vars: - PACKAGES: - - ./ai - - ./anthropic - - ./examples - - ./openai - tasks: fmt: desc: Run gofumpt for all packages cmds: - - for: { var: PACKAGES } - cmd: cd {{.ITEM}} && gofmt -s -w . + - gofmt -s -w . modernize: desc: Run modernize for all packages cmds: - - for: { var: PACKAGES } - cmd: cd {{.ITEM}} && modernize -fix ./... + - modernize -fix ./... lint: desc: Run base linters for all packages cmds: - - for: { var: PACKAGES } - cmd: cd {{.ITEM}} && golangci-lint run + - golangci-lint run test: desc: Run tests for all packages cmds: - - for: { var: PACKAGES } - cmd: cd {{.ITEM}} && go test ./... {{.CLI_ARGS}} + - go test ./... {{.CLI_ARGS}} diff --git a/ai/go.mod b/ai/go.mod deleted file mode 100644 index 783293b0017f81b07064edc56e05b376e7a614bf..0000000000000000000000000000000000000000 --- a/ai/go.mod +++ /dev/null @@ -1,14 +0,0 @@ -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 -) diff --git a/ai/go.sum b/ai/go.sum deleted file mode 100644 index 5dc0e5c958f91ba02a0075086a359e7637810c1d..0000000000000000000000000000000000000000 --- a/ai/go.sum +++ /dev/null @@ -1,12 +0,0 @@ -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= diff --git a/anthropic/go.mod b/anthropic/go.mod deleted file mode 100644 index 9ff361f2a7835947c4a14a69bc339eb10535e428..0000000000000000000000000000000000000000 --- a/anthropic/go.mod +++ /dev/null @@ -1,18 +0,0 @@ -module github.com/charmbracelet/ai/anthropic - -go 1.24.5 - -require ( - github.com/anthropics/anthropic-sdk-go v1.10.0 - github.com/charmbracelet/ai/ai v0.0.0-00010101000000-000000000000 -) - -require ( - github.com/go-viper/mapstructure/v2 v2.4.0 // 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 diff --git a/anthropic/go.sum b/anthropic/go.sum deleted file mode 100644 index c2d26e04229853e993e04308b75ec256a9b04857..0000000000000000000000000000000000000000 --- a/anthropic/go.sum +++ /dev/null @@ -1,22 +0,0 @@ -github.com/anthropics/anthropic-sdk-go v1.10.0 h1:jDKQTfC0miIEj21eMmPrNSLKTNdNa3nHZOhd4wZz1cI= -github.com/anthropics/anthropic-sdk-go v1.10.0/go.mod h1:WTz31rIUHUHqai2UslPpw5CwXrQP3geYBioRV4WOLvE= -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= -github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= -github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= -github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= -github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= -github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/examples/go.mod b/examples/go.mod deleted file mode 100644 index 4d8e86af3644dca6f3202a41afca62e8548a509a..0000000000000000000000000000000000000000 --- a/examples/go.mod +++ /dev/null @@ -1,26 +0,0 @@ -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/anthropic v0.0.0-00010101000000-000000000000 - github.com/charmbracelet/ai/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/anthropic => ../anthropic - -replace github.com/charmbracelet/ai/openai => ../openai diff --git a/examples/go.sum b/examples/go.sum deleted file mode 100644 index c33818589c82f7ad7b5d43fefc4187cc2413ac4a..0000000000000000000000000000000000000000 --- a/examples/go.sum +++ /dev/null @@ -1,26 +0,0 @@ -github.com/anthropics/anthropic-sdk-go v1.10.0 h1:jDKQTfC0miIEj21eMmPrNSLKTNdNa3nHZOhd4wZz1cI= -github.com/anthropics/anthropic-sdk-go v1.10.0/go.mod h1:WTz31rIUHUHqai2UslPpw5CwXrQP3geYBioRV4WOLvE= -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/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/openai/openai-go/v2 v2.2.1 h1:rixFJaRnxFqOhXk/0PdtMearOTVf3s17jEXe091YE+M= -github.com/openai/openai-go/v2 v2.2.1/go.mod h1:sIUkR+Cu/PMUVkSKhkk742PRURkQOCFhiwJ7eRSBqmk= -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= -github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= -github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= -github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= -github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= -github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/openai/go.mod b/go.mod similarity index 62% rename from openai/go.mod rename to go.mod index 97d3bcfae837797219497325c352eeadfcbf90dd..c139e7a0653fc940b9fc8985f95d0a5e6c54673c 100644 --- a/openai/go.mod +++ b/go.mod @@ -1,17 +1,17 @@ -module github.com/charmbracelet/ai/openai +module github.com/charmbracelet/ai go 1.24.5 require ( - github.com/charmbracelet/ai/ai v0.0.0-00010101000000-000000000000 + github.com/anthropics/anthropic-sdk-go v1.10.0 + github.com/go-viper/mapstructure/v2 v2.4.0 github.com/google/uuid v1.6.0 - github.com/openai/openai-go/v2 v2.2.1 + github.com/openai/openai-go/v2 v2.3.0 github.com/stretchr/testify v1.11.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-viper/mapstructure/v2 v2.4.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/tidwall/gjson v1.18.0 // indirect github.com/tidwall/match v1.1.1 // indirect @@ -19,5 +19,3 @@ require ( github.com/tidwall/sjson v1.2.5 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace github.com/charmbracelet/ai/ai => ../ai diff --git a/openai/go.sum b/go.sum similarity index 85% rename from openai/go.sum rename to go.sum index d5724e364ff8c5f8deaf7698b5114859d6cc33da..21cd1efb3cabc401e221e349198ddb6f53f2b6c9 100644 --- a/openai/go.sum +++ b/go.sum @@ -1,11 +1,13 @@ +github.com/anthropics/anthropic-sdk-go v1.10.0 h1:jDKQTfC0miIEj21eMmPrNSLKTNdNa3nHZOhd4wZz1cI= +github.com/anthropics/anthropic-sdk-go v1.10.0/go.mod h1:WTz31rIUHUHqai2UslPpw5CwXrQP3geYBioRV4WOLvE= 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/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/openai/openai-go/v2 v2.2.1 h1:rixFJaRnxFqOhXk/0PdtMearOTVf3s17jEXe091YE+M= -github.com/openai/openai-go/v2 v2.2.1/go.mod h1:sIUkR+Cu/PMUVkSKhkk742PRURkQOCFhiwJ7eRSBqmk= +github.com/openai/openai-go/v2 v2.3.0 h1:y9U+V1tlHjvvb/5XIswuySqnG5EnKBFAbMxgBvTHXvg= +github.com/openai/openai-go/v2 v2.3.0/go.mod h1:sIUkR+Cu/PMUVkSKhkk742PRURkQOCFhiwJ7eRSBqmk= 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= diff --git a/go.work b/go.work deleted file mode 100644 index 3cc1bbc7f334e2f60e496c62ca05209f4d0cb8ef..0000000000000000000000000000000000000000 --- a/go.work +++ /dev/null @@ -1,8 +0,0 @@ -go 1.24.5 - -use ( - ./ai - ./anthropic - ./examples - ./openai -) diff --git a/go.work.sum b/go.work.sum deleted file mode 100644 index 71775dd444f8fe9ad3f66ce329c307bc14a970b4..0000000000000000000000000000000000000000 --- a/go.work.sum +++ /dev/null @@ -1,50 +0,0 @@ -cloud.google.com/go/auth v0.7.2/go.mod h1:VEc4p5NNxycWQTMQEDQF0bd6aTMb6VgYDXEwiJJQAbs= -cloud.google.com/go/auth/oauth2adapt v0.2.3/go.mod h1:tMQXOfZzFuNuUxOypHlQEXgdfX5cuhwU+ffUuXRJE8I= -cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0/go.mod h1:XCW7KnZet0Opnr7HccfUw1PLc4CjHqpcaxW8DHklNkQ= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/aws/aws-sdk-go-v2 v1.30.3/go.mod h1:nIQjQVp5sfpQcTc9mPSr1B0PaWK5ByX9MOoDadSN4lc= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.3/go.mod h1:UbnqO+zjqk3uIt9yCACHJ9IVNhyhOCnYk8yA19SAWrM= -github.com/aws/aws-sdk-go-v2/config v1.27.27/go.mod h1:MVYamCg76dFNINkZFu4n4RjDixhVr51HLj4ErWzrVwg= -github.com/aws/aws-sdk-go-v2/credentials v1.17.27/go.mod h1:gniiwbGahQByxan6YjQUMcW4Aov6bLC3m+evgcoN4r4= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.11/go.mod h1:SeSUYBLsMYFoRvHE0Tjvn7kbxaUhl75CJi1sbfhMxkU= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15/go.mod h1:U9ke74k1n2bf+RIgoX1SXFed1HLs51OgUSs+Ph0KJP8= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15/go.mod h1:ZQLZqhcu+JhSrA9/NXRm8SkDvsycE+JkV3WGY41e+IM= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3/go.mod h1:GlAeCkHwugxdHaueRr4nhPuY+WW+gR8UjlcqzPr1SPI= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.17/go.mod h1:RkZEx4l0EHYDJpWppMJ3nD9wZJAa8/0lq9aVC+r2UII= -github.com/aws/aws-sdk-go-v2/service/sso v1.22.4/go.mod h1:ooyCOXjvJEsUw7x+ZDHeISPMhtwI3ZCB7ggFMcFfWLU= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4/go.mod h1:0oxfLkpz3rQ/CHlx5hB7H69YUpFiI1tql6Q6Ne+1bCw= -github.com/aws/aws-sdk-go-v2/service/sts v1.30.3/go.mod h1:zwySh8fpFyXp9yOr/KVzxOl8SRqgf/IDw5aUt9UKFcQ= -github.com/aws/smithy-go v1.20.3/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= -github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= -go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= -go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= -go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= -golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= -golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= -golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -google.golang.org/api v0.189.0/go.mod h1:FLWGJKb0hb+pU2j+rJqwbnsF+ym+fQs73rbJ+KAUgy8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= diff --git a/scripts/generate_ci b/scripts/generate_ci deleted file mode 100755 index b74c6542acc21d19756a2e09951591958fb7b3c9..0000000000000000000000000000000000000000 --- a/scripts/generate_ci +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bash - -# shellcheck disable=SC2016 -find . -type f -name go.mod | sort | while read -r mod; do - dir="$(dirname "$mod")" - name="$(basename "$dir")" - # get the parent directory when the module is nested semver-style - if [[ "$name" =~ ^v[0-9]+.*$ ]]; then - ver="$(basename "$dir")" - dir="$(dirname "$dir")" - name="$(basename "$dir")-$ver" - fi - - sum="$dir/go.sum" - echo "# auto-generated by scripts/builds. DO NOT EDIT. -name: $name - -on: - push: - branches: - - main - pull_request: - paths: - - $(dirname "$mod" | cut -f2- -d/)/** - - .github/workflows/${name}.yml - -jobs: - build: - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: \${{ matrix.os }} - defaults: - run: - working-directory: $(dirname "$mod") - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version-file: $mod - cache: true - cache-dependency-path: $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: $(dirname "$mod")/... - golangci_path: .golangci.yml -" >"./.github/workflows/${name}.yml" -done