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
3 changes: 2 additions & 1 deletion cmd/gomodel/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"context"
"encoding/json"
"fmt"
"io"
"net"
Expand All @@ -11,6 +10,8 @@ import (
"strings"
"time"

"github.com/goccy/go-json"

"gomodel/config"
)

Expand Down
3 changes: 2 additions & 1 deletion cmd/recordapi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package main

import (
"bytes"
"encoding/json"
"flag"
"fmt"
"io"
Expand All @@ -18,6 +17,8 @@ import (
"path/filepath"
"strings"
"time"

"github.com/goccy/go-json"
)

const oracleDefaultModel = "openai.gpt-oss-120b"
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.53.5
github.com/cespare/xxhash/v2 v2.3.0
github.com/coder/websocket v1.8.15
github.com/goccy/go-json v0.10.6
github.com/google/uuid v1.6.0
github.com/jackc/pgx/v5 v5.10.0
github.com/joho/godotenv v1.5.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ github.com/go-openapi/testify/enable/yaml/v2 v2.4.0 h1:7SgOMTvJkM8yWrQlU8Jm18VeD
github.com/go-openapi/testify/enable/yaml/v2 v2.4.0/go.mod h1:14iV8jyyQlinc9StD7w1xVPW3CO3q1Gj04Jy//Kw4VM=
github.com/go-openapi/testify/v2 v2.4.0 h1:8nsPrHVCWkQ4p8h1EsRVymA2XABB4OT40gcvAu+voFM=
github.com/go-openapi/testify/v2 v2.4.0/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54=
github.com/goccy/go-json v0.10.6 h1:p8HrPJzOakx/mn/bQtjgNjdTcN+/S6FcG2CTtQOrHVU=
github.com/goccy/go-json v0.10.6/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
Expand Down
3 changes: 2 additions & 1 deletion internal/admin/handler_guardrails.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package admin

import (
"encoding/json"
"errors"
"net/http"
"strings"

"github.com/goccy/go-json"

"github.com/labstack/echo/v5"

"gomodel/internal/core"
Expand Down
3 changes: 2 additions & 1 deletion internal/admin/handler_live.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package admin

import (
"encoding/json"
"fmt"
"net/http"
"strconv"
"strings"
"time"

"github.com/goccy/go-json"

"github.com/labstack/echo/v5"

"gomodel/internal/core"
Expand Down
3 changes: 2 additions & 1 deletion internal/aliases/batch_preparer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package aliases

import (
"context"
"encoding/json"
"fmt"
"strings"

"github.com/goccy/go-json"

"gomodel/internal/core"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/anthropicapi/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package anthropicapi

import (
"bytes"
"encoding/json"
"fmt"
"io"
"strings"

"github.com/goccy/go-json"

"gomodel/internal/core"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/anthropicapi/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package anthropicapi

import (
"bytes"
"encoding/json"
"strings"

"github.com/goccy/go-json"

"gomodel/internal/core"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/anthropicapi/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package anthropicapi
import (
"bufio"
"bytes"
"encoding/json"
"io"

"github.com/goccy/go-json"

"gomodel/internal/streaming"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/anthropicapi/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// independent of which provider ultimately serves the request.
package anthropicapi

import "encoding/json"
import "github.com/goccy/go-json"

// MessagesRequest is the Anthropic Messages API request body.
// System and message content fields are polymorphic on the wire (string or
Expand Down
3 changes: 2 additions & 1 deletion internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package app

import (
"context"
"encoding/json"
"errors"
"fmt"
"log/slog"
Expand All @@ -14,6 +13,8 @@ import (
"sync"
"time"

"github.com/goccy/go-json"

"gomodel/config"
"gomodel/internal/admin"
"gomodel/internal/admin/dashboard"
Expand Down
3 changes: 2 additions & 1 deletion internal/auditlog/auditlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ package auditlog

import (
"context"
"encoding/json"
"log/slog"
"strings"
"time"

"github.com/goccy/go-json"
)

// LogStore defines the interface for audit log storage backends.
Expand Down
5 changes: 3 additions & 2 deletions internal/auditlog/entry_capture.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package auditlog

import (
"context"
"encoding/json"
"errors"
"net/http"
"net/url"
"strings"

"github.com/goccy/go-json"

"gomodel/internal/core"
)

Expand Down Expand Up @@ -211,7 +212,7 @@ func internalJSONAuditHeaders(ctx context.Context, requestID string) http.Header
headers.Set(core.UserPathHeaderNameFromContext(ctx), userPath)
}
if snapshot := core.GetRequestSnapshot(ctx); snapshot != nil {
snapshotHeaders := snapshot.GetHeaders()
snapshotHeaders := snapshot.HeadersView()
for _, key := range []string{"Traceparent", "Tracestate", "Baggage"} {
for _, value := range snapshotHeaders[key] {
headers.Add(key, value)
Expand Down
3 changes: 2 additions & 1 deletion internal/auditlog/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import (
"context"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"io"
"net"
"net/http"
"strings"
"time"
"unicode/utf8"

"github.com/goccy/go-json"

"github.com/andybalholm/brotli"
"github.com/google/uuid"
"github.com/labstack/echo/v5"
Expand Down
3 changes: 2 additions & 1 deletion internal/auditlog/reader_postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"gomodel/internal/storage/sqlutil"

"context"
"encoding/json"
"fmt"
"log/slog"

"github.com/goccy/go-json"

"github.com/jackc/pgx/v5/pgxpool"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/auditlog/reader_sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (

"context"
"database/sql"
"encoding/json"
"fmt"
"log/slog"
"sort"
"time"

"github.com/goccy/go-json"
)

const sqliteTimestampBoundaryLayout = "2006-01-02T15:04:05"
Expand Down
3 changes: 2 additions & 1 deletion internal/batch/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package batch

import (
"context"
"encoding/json"
"errors"
"fmt"
"strconv"
"strings"
"time"

"github.com/goccy/go-json"

"gomodel/internal/core"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/cache/modelcache/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package modelcache

import (
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
"sync"

"github.com/goccy/go-json"
)

// LocalCache implements Cache using local file storage.
Expand Down
3 changes: 2 additions & 1 deletion internal/cache/modelcache/modelcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ package modelcache

import (
"context"
"encoding/json"
"time"

"github.com/goccy/go-json"
)

// ModelCache represents the cached model data structure.
Expand Down
3 changes: 2 additions & 1 deletion internal/cache/modelcache/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package modelcache

import (
"context"
"encoding/json"
"fmt"
"log/slog"
"time"

"github.com/goccy/go-json"

"gomodel/internal/cache"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/conversationstore/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ package conversationstore

import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"time"

"github.com/goccy/go-json"

"gomodel/internal/core"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/conversationstore/store_memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package conversationstore

import (
"context"
"encoding/json"
"fmt"
"sort"
"sync"
"time"

"github.com/goccy/go-json"

"gomodel/internal/core"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/core/audio.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package core

import (
"encoding/json"
"io"
"strings"

"github.com/goccy/go-json"
)

// AudioSpeechRequest is an OpenAI-compatible POST /v1/audio/speech
Expand Down
2 changes: 1 addition & 1 deletion internal/core/batch.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package core

import "encoding/json"
import "github.com/goccy/go-json"

// BatchRequest is OpenAI-compatible for core fields and extends with inline requests.
//
Expand Down
2 changes: 1 addition & 1 deletion internal/core/batch_json.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package core

import "encoding/json"
import "github.com/goccy/go-json"

func (r *BatchRequest) UnmarshalJSON(data []byte) error {
var raw struct {
Expand Down
3 changes: 2 additions & 1 deletion internal/core/batch_preparation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package core
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"maps"
"net/http"
"strings"

"github.com/goccy/go-json"
)

// BatchPreparationMetadata captures request-scoped batch preprocessing effects
Expand Down
3 changes: 2 additions & 1 deletion internal/core/chat_content.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package core

import (
"bytes"
"encoding/json"
"fmt"
"strings"

"github.com/goccy/go-json"
)

// ContentPart represents a single OpenAI-compatible multimodal chat content part.
Expand Down
2 changes: 1 addition & 1 deletion internal/core/chat_json.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package core

import "encoding/json"
import "github.com/goccy/go-json"

func (r *ChatRequest) UnmarshalJSON(data []byte) error {
var raw struct {
Expand Down
3 changes: 2 additions & 1 deletion internal/core/conversations.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package core

import (
"bytes"
"encoding/json"
"fmt"
"unicode/utf8"

"github.com/goccy/go-json"
)

// ConversationObject is the value of the "object" field on a conversation.
Expand Down
Loading