mirror of
https://github.com/alibaba/open-code-review.git
synced 2026-07-09 17:28:58 +00:00
refactor(llm): replace hand-rolled HTTP clients with official Anthropic and OpenAI SDKs
Migrated internal/llm from manual net/http implementation to anthropic-sdk-go v1.47.0 and openai-go/v3 v3.39.0, reducing ~400 lines of retry, request-building, and streaming code. Simplified LLMClient interface to single CompletionsWithCtx method. Fixed Anthropic auth to use WithAuthToken (Bearer) instead of WithAPIKey (X-Api-Key) for proxy compatibility. Fixed OpenAI message builder to use ExtractText() for proper []ContentBlock handling.
This commit is contained in:
parent
6b7038b3d3
commit
7d75c3a9d3
4 changed files with 302 additions and 593 deletions
13
go.mod
13
go.mod
|
|
@ -3,7 +3,9 @@ module github.com/open-code-review/open-code-review
|
|||
go 1.25.0
|
||||
|
||||
require (
|
||||
github.com/anthropics/anthropic-sdk-go v1.47.0
|
||||
github.com/bmatcuk/doublestar/v4 v4.10.0
|
||||
github.com/openai/openai-go/v3 v3.39.0
|
||||
github.com/pkoukk/tiktoken-go v0.1.8
|
||||
go.opentelemetry.io/otel v1.43.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.43.0
|
||||
|
|
@ -17,6 +19,8 @@ require (
|
|||
)
|
||||
|
||||
require (
|
||||
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
||||
github.com/buger/jsonparser v1.1.2 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/dlclark/regexp2 v1.10.0 // indirect
|
||||
|
|
@ -24,10 +28,19 @@ require (
|
|||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
|
||||
github.com/invopop/jsonschema v0.14.0 // indirect
|
||||
github.com/pb33f/ordered-map/v2 v2.3.1 // indirect
|
||||
github.com/standard-webhooks/standard-webhooks/libraries v0.0.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
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
|
||||
go.yaml.in/yaml/v4 v4.0.0-rc.2 // indirect
|
||||
golang.org/x/net v0.52.0 // indirect
|
||||
golang.org/x/sync v0.20.0 // indirect
|
||||
golang.org/x/sys v0.42.0 // indirect
|
||||
golang.org/x/text v0.35.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue