diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index a27a6688..3e0731a1 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -10,7 +10,7 @@ on: jobs: pre-commit: runs-on: ubuntu-latest - name: Run pre-commit hooks on Go, Rust, and Python files + name: Run pre-commit hooks on Go, Rust, JavaScripts and Python files steps: - name: Check out the repo @@ -28,6 +28,11 @@ jobs: with: go-version: '1.24' + - name: Set up Node + uses: actions/setup-node@v5 + with: + node-version: 23 + - name: Set up Rust uses: dtolnay/rust-toolchain@stable with: @@ -60,6 +65,13 @@ jobs: ~/go/pkg/mod key: ${{ runner.os }}-go-precommit-${{ hashFiles('**/go.sum') }} + - name: Cache Node dependencies + uses: actions/cache@v4 + with: + path: | + ~/website/node_modules + key: ${{ runner.os }}-node-precommit-${{ hashFiles('website/package.json') }} + - name: Cache pre-commit environments uses: actions/cache@v4 with: @@ -69,13 +81,14 @@ jobs: - name: Install pre-commit run: pip install pre-commit - - name: Run pre-commit on Go, Rust, and Python files + - name: Run pre-commit on Go, Rust, JavaScript and Python files run: | - # Find all Go, Rust, and Python files (excluding vendored/generated code) - FILES=$(find . -type f \( -name "*.go" -o -name "*.rs" -o -name "*.py" \) \ + # Find all Go, Rust, JavaScripts and Python files (excluding vendored/generated code) + FILES=$(find . -type f \( -name "*.go" -o -name "*.rs" -o -name "*.py" -o -name "*.js" \) \ ! -path "./target/*" \ ! -path "./candle-binding/target/*" \ ! -path "./.git/*" \ + ! -path "./node_modules/*" \ ! -path "./vendor/*" \ ! -path "./__pycache__/*" \ ! -path "./site/*" \ @@ -86,7 +99,7 @@ jobs: echo "Running pre-commit on files: $FILES" pre-commit run --files $FILES else - echo "No Go, Rust, or Python files found to check" + echo "No Go, Rust, JavaScript or Python files found to check" fi - name: Show pre-commit results diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9d57378f..4b65a545 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,12 +6,12 @@ repos: rev: v6.0.0 hooks: - id: trailing-whitespace - files: \.(go|rs|py)$ + files: \.(go|rs|py|js)$ - id: end-of-file-fixer - files: \.(go|rs|py)$ + files: \.(go|rs|py|js)$ - id: check-added-large-files args: ['--maxkb=500'] - files: \.(go|rs|py)$ + files: \.(go|rs|py|js)$ # Go specific hooks - repo: local @@ -22,6 +22,15 @@ repos: language: system files: \.go$ +# JavaScript specific hooks +- repo: local + hooks: + - id: js-lint + name: js lint + entry: bash -c 'cd website && npm install eslint && npm run lint' + language: system + files: \.js$ + # Rust specific hooks - repo: local hooks: diff --git a/Makefile b/Makefile index 9f3f4258..0eb27304 100644 --- a/Makefile +++ b/Makefile @@ -215,3 +215,11 @@ docs-serve: docs-build docs-clean: @echo "Cleaning documentation build artifacts..." cd website && npm run clear + +docs-lint: + @echo "Linting documentation..." + cd website && npm run lint + +docs-lint-fix: + @echo "Fixing documentation lint issues..." + cd website && npm run lint:fix diff --git a/src/semantic-router/cmd/main.go b/src/semantic-router/cmd/main.go index d32db437..e92e3ced 100644 --- a/src/semantic-router/cmd/main.go +++ b/src/semantic-router/cmd/main.go @@ -8,9 +8,9 @@ import ( "os" "github.com/prometheus/client_golang/prometheus/promhttp" - "github.com/vllm-project/semantic-router/semantic-router/pkg/api" - "github.com/vllm-project/semantic-router/semantic-router/pkg/extproc" - "github.com/vllm-project/semantic-router/semantic-router/pkg/observability" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/api" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/extproc" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/observability" ) func main() { diff --git a/src/semantic-router/go.mod b/src/semantic-router/go.mod index 7c4e59f7..3b6513b2 100644 --- a/src/semantic-router/go.mod +++ b/src/semantic-router/go.mod @@ -1,11 +1,11 @@ -module github.com/vllm-project/semantic-router/semantic-router +module github.com/vllm-project/semantic-router/src/semantic-router go 1.24.1 replace ( github.com/vllm-project/semantic-router/candle-binding => ../../candle-binding - github.com/vllm-project/semantic-router/semantic-router/pkg/config => ./pkg/config - github.com/vllm-project/semantic-router/semantic-router/pkg/extproc => ./pkg/extproc + github.com/vllm-project/semantic-router/src/semantic-router/pkg/config => ./pkg/config + github.com/vllm-project/semantic-router/src/semantic-router/pkg/extproc => ./pkg/extproc ) require ( diff --git a/src/semantic-router/pkg/api/server.go b/src/semantic-router/pkg/api/server.go index 47c64464..d17e8803 100644 --- a/src/semantic-router/pkg/api/server.go +++ b/src/semantic-router/pkg/api/server.go @@ -10,9 +10,9 @@ import ( "sync" "time" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" - "github.com/vllm-project/semantic-router/semantic-router/pkg/metrics" - "github.com/vllm-project/semantic-router/semantic-router/pkg/services" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/metrics" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/services" ) // ClassificationAPIServer holds the server state and dependencies diff --git a/src/semantic-router/pkg/api/server_test.go b/src/semantic-router/pkg/api/server_test.go index 243edcb8..594839e7 100644 --- a/src/semantic-router/pkg/api/server_test.go +++ b/src/semantic-router/pkg/api/server_test.go @@ -9,8 +9,8 @@ import ( "net/http/httptest" "testing" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" - "github.com/vllm-project/semantic-router/semantic-router/pkg/services" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/services" ) func TestHandleBatchClassification(t *testing.T) { diff --git a/src/semantic-router/pkg/cache/cache_test.go b/src/semantic-router/pkg/cache/cache_test.go index a0a9594c..d4787b47 100644 --- a/src/semantic-router/pkg/cache/cache_test.go +++ b/src/semantic-router/pkg/cache/cache_test.go @@ -11,7 +11,7 @@ import ( . "github.com/onsi/gomega" candle "github.com/vllm-project/semantic-router/candle-binding" - "github.com/vllm-project/semantic-router/semantic-router/pkg/cache" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/cache" ) func TestCache(t *testing.T) { diff --git a/src/semantic-router/pkg/config/config_test.go b/src/semantic-router/pkg/config/config_test.go index fc01cee8..464f0cc7 100644 --- a/src/semantic-router/pkg/config/config_test.go +++ b/src/semantic-router/pkg/config/config_test.go @@ -8,7 +8,7 @@ import ( "gopkg.in/yaml.v3" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/src/semantic-router/pkg/config/parse_configfile_test.go b/src/semantic-router/pkg/config/parse_configfile_test.go index d0fe30bd..b0b3d692 100644 --- a/src/semantic-router/pkg/config/parse_configfile_test.go +++ b/src/semantic-router/pkg/config/parse_configfile_test.go @@ -8,7 +8,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" ) var _ = Describe("ParseConfigFile and ReplaceGlobalConfig", func() { diff --git a/src/semantic-router/pkg/extproc/caching_test.go b/src/semantic-router/pkg/extproc/caching_test.go index ab7f04e8..b0f3f6bd 100644 --- a/src/semantic-router/pkg/extproc/caching_test.go +++ b/src/semantic-router/pkg/extproc/caching_test.go @@ -9,9 +9,9 @@ import ( ext_proc "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3" - "github.com/vllm-project/semantic-router/semantic-router/pkg/cache" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" - "github.com/vllm-project/semantic-router/semantic-router/pkg/extproc" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/cache" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/extproc" ) var _ = Describe("Caching Functionality", func() { diff --git a/src/semantic-router/pkg/extproc/edge_cases_test.go b/src/semantic-router/pkg/extproc/edge_cases_test.go index 862d015d..f402edac 100644 --- a/src/semantic-router/pkg/extproc/edge_cases_test.go +++ b/src/semantic-router/pkg/extproc/edge_cases_test.go @@ -11,9 +11,9 @@ import ( ext_proc "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3" - "github.com/vllm-project/semantic-router/semantic-router/pkg/cache" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" - "github.com/vllm-project/semantic-router/semantic-router/pkg/extproc" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/cache" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/extproc" ) var _ = Describe("Edge Cases and Error Conditions", func() { diff --git a/src/semantic-router/pkg/extproc/endpoint_selection_test.go b/src/semantic-router/pkg/extproc/endpoint_selection_test.go index 53e6b4c6..f3e74cb8 100644 --- a/src/semantic-router/pkg/extproc/endpoint_selection_test.go +++ b/src/semantic-router/pkg/extproc/endpoint_selection_test.go @@ -8,8 +8,8 @@ import ( core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" ext_proc "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" - "github.com/vllm-project/semantic-router/semantic-router/pkg/extproc" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/extproc" ) var _ = Describe("Endpoint Selection", func() { diff --git a/src/semantic-router/pkg/extproc/reason_mode_config_test.go b/src/semantic-router/pkg/extproc/reason_mode_config_test.go index e58b7560..3eccfa4b 100644 --- a/src/semantic-router/pkg/extproc/reason_mode_config_test.go +++ b/src/semantic-router/pkg/extproc/reason_mode_config_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" ) // TestReasoningModeConfiguration demonstrates how the reasoning mode works with the new config-based approach diff --git a/src/semantic-router/pkg/extproc/reason_mode_selector.go b/src/semantic-router/pkg/extproc/reason_mode_selector.go index 00051736..4e27d9d2 100644 --- a/src/semantic-router/pkg/extproc/reason_mode_selector.go +++ b/src/semantic-router/pkg/extproc/reason_mode_selector.go @@ -6,8 +6,8 @@ import ( "log" "strings" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" - "github.com/vllm-project/semantic-router/semantic-router/pkg/metrics" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/metrics" ) // shouldUseReasoningMode determines if reasoning mode should be enabled based on the query category diff --git a/src/semantic-router/pkg/extproc/reason_mode_selector_test.go b/src/semantic-router/pkg/extproc/reason_mode_selector_test.go index ffe95d66..0a8a1f0a 100644 --- a/src/semantic-router/pkg/extproc/reason_mode_selector_test.go +++ b/src/semantic-router/pkg/extproc/reason_mode_selector_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" ) // TestModelReasoningFamily tests the new family-based configuration approach diff --git a/src/semantic-router/pkg/extproc/reasoning_integration_test.go b/src/semantic-router/pkg/extproc/reasoning_integration_test.go index 799899bb..e4c9dbc7 100644 --- a/src/semantic-router/pkg/extproc/reasoning_integration_test.go +++ b/src/semantic-router/pkg/extproc/reasoning_integration_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" ) // TestReasoningModeIntegration tests the complete reasoning mode integration diff --git a/src/semantic-router/pkg/extproc/request_handler.go b/src/semantic-router/pkg/extproc/request_handler.go index a9323e45..defc281a 100644 --- a/src/semantic-router/pkg/extproc/request_handler.go +++ b/src/semantic-router/pkg/extproc/request_handler.go @@ -12,11 +12,11 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/vllm-project/semantic-router/semantic-router/pkg/cache" - "github.com/vllm-project/semantic-router/semantic-router/pkg/metrics" - "github.com/vllm-project/semantic-router/semantic-router/pkg/observability" - "github.com/vllm-project/semantic-router/semantic-router/pkg/utils/http" - "github.com/vllm-project/semantic-router/semantic-router/pkg/utils/pii" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/cache" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/metrics" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/observability" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/utils/http" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/utils/pii" ) // parseOpenAIRequest parses the raw JSON using the OpenAI SDK types diff --git a/src/semantic-router/pkg/extproc/request_processing_test.go b/src/semantic-router/pkg/extproc/request_processing_test.go index d2f6326b..6d29edca 100644 --- a/src/semantic-router/pkg/extproc/request_processing_test.go +++ b/src/semantic-router/pkg/extproc/request_processing_test.go @@ -10,10 +10,10 @@ import ( core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" ext_proc "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3" - "github.com/vllm-project/semantic-router/semantic-router/pkg/cache" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" - "github.com/vllm-project/semantic-router/semantic-router/pkg/extproc" - "github.com/vllm-project/semantic-router/semantic-router/pkg/tools" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/cache" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/extproc" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/tools" ) var _ = Describe("Request Processing", func() { diff --git a/src/semantic-router/pkg/extproc/response_handler.go b/src/semantic-router/pkg/extproc/response_handler.go index c39ad73a..6805f9c3 100644 --- a/src/semantic-router/pkg/extproc/response_handler.go +++ b/src/semantic-router/pkg/extproc/response_handler.go @@ -8,8 +8,8 @@ import ( ext_proc "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3" "github.com/openai/openai-go" - "github.com/vllm-project/semantic-router/semantic-router/pkg/metrics" - "github.com/vllm-project/semantic-router/semantic-router/pkg/observability" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/metrics" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/observability" ) // handleResponseHeaders processes the response headers diff --git a/src/semantic-router/pkg/extproc/router.go b/src/semantic-router/pkg/extproc/router.go index 152d1a06..d18b7d10 100644 --- a/src/semantic-router/pkg/extproc/router.go +++ b/src/semantic-router/pkg/extproc/router.go @@ -8,12 +8,12 @@ import ( ext_proc "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3" candle_binding "github.com/vllm-project/semantic-router/candle-binding" - "github.com/vllm-project/semantic-router/semantic-router/pkg/cache" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" - "github.com/vllm-project/semantic-router/semantic-router/pkg/services" - "github.com/vllm-project/semantic-router/semantic-router/pkg/tools" - "github.com/vllm-project/semantic-router/semantic-router/pkg/utils/classification" - "github.com/vllm-project/semantic-router/semantic-router/pkg/utils/pii" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/cache" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/services" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/tools" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/utils/classification" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/utils/pii" ) var ( diff --git a/src/semantic-router/pkg/extproc/security_test.go b/src/semantic-router/pkg/extproc/security_test.go index d2812846..71030e12 100644 --- a/src/semantic-router/pkg/extproc/security_test.go +++ b/src/semantic-router/pkg/extproc/security_test.go @@ -12,12 +12,12 @@ import ( ext_proc "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3" - "github.com/vllm-project/semantic-router/semantic-router/pkg/cache" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" - "github.com/vllm-project/semantic-router/semantic-router/pkg/extproc" - "github.com/vllm-project/semantic-router/semantic-router/pkg/utils/classification" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/cache" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/extproc" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/utils/classification" - "github.com/vllm-project/semantic-router/semantic-router/pkg/utils/pii" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/utils/pii" ) const ( diff --git a/src/semantic-router/pkg/extproc/server.go b/src/semantic-router/pkg/extproc/server.go index 1c999976..12693e3e 100644 --- a/src/semantic-router/pkg/extproc/server.go +++ b/src/semantic-router/pkg/extproc/server.go @@ -13,7 +13,7 @@ import ( ext_proc "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3" "github.com/fsnotify/fsnotify" - "github.com/vllm-project/semantic-router/semantic-router/pkg/observability" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/observability" "google.golang.org/grpc" ) diff --git a/src/semantic-router/pkg/extproc/stream_handling_test.go b/src/semantic-router/pkg/extproc/stream_handling_test.go index 2d5880b8..b9c2e0c3 100644 --- a/src/semantic-router/pkg/extproc/stream_handling_test.go +++ b/src/semantic-router/pkg/extproc/stream_handling_test.go @@ -13,8 +13,8 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" - "github.com/vllm-project/semantic-router/semantic-router/pkg/extproc" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/extproc" ) var _ = Describe("Process Stream Handling", func() { diff --git a/src/semantic-router/pkg/extproc/test_utils_test.go b/src/semantic-router/pkg/extproc/test_utils_test.go index 80d1b9ad..5ca4ca3b 100644 --- a/src/semantic-router/pkg/extproc/test_utils_test.go +++ b/src/semantic-router/pkg/extproc/test_utils_test.go @@ -10,12 +10,12 @@ import ( "google.golang.org/grpc/metadata" candle_binding "github.com/vllm-project/semantic-router/candle-binding" - "github.com/vllm-project/semantic-router/semantic-router/pkg/cache" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" - "github.com/vllm-project/semantic-router/semantic-router/pkg/extproc" - "github.com/vllm-project/semantic-router/semantic-router/pkg/tools" - "github.com/vllm-project/semantic-router/semantic-router/pkg/utils/classification" - "github.com/vllm-project/semantic-router/semantic-router/pkg/utils/pii" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/cache" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/extproc" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/tools" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/utils/classification" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/utils/pii" ) // MockStream implements the ext_proc.ExternalProcessor_ProcessServer interface for testing diff --git a/src/semantic-router/pkg/metrics/metrics.go b/src/semantic-router/pkg/metrics/metrics.go index 7be69000..bc465848 100644 --- a/src/semantic-router/pkg/metrics/metrics.go +++ b/src/semantic-router/pkg/metrics/metrics.go @@ -8,7 +8,7 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" ) // Minimal fallback bucket configurations - used only when configuration is completely missing diff --git a/src/semantic-router/pkg/metrics/metrics_test.go b/src/semantic-router/pkg/metrics/metrics_test.go index c84c8f18..371ad51d 100644 --- a/src/semantic-router/pkg/metrics/metrics_test.go +++ b/src/semantic-router/pkg/metrics/metrics_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" ) // TestMain ensures metrics are initialized before running tests diff --git a/src/semantic-router/pkg/services/classification.go b/src/semantic-router/pkg/services/classification.go index 638fe5b5..88f7705c 100644 --- a/src/semantic-router/pkg/services/classification.go +++ b/src/semantic-router/pkg/services/classification.go @@ -4,8 +4,8 @@ import ( "fmt" "time" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" - "github.com/vllm-project/semantic-router/semantic-router/pkg/utils/classification" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/utils/classification" ) // Global classification service instance diff --git a/src/semantic-router/pkg/utils/classification/classifier.go b/src/semantic-router/pkg/utils/classification/classifier.go index 40a3ad01..0923ec8a 100644 --- a/src/semantic-router/pkg/utils/classification/classifier.go +++ b/src/semantic-router/pkg/utils/classification/classifier.go @@ -8,8 +8,8 @@ import ( "time" candle_binding "github.com/vllm-project/semantic-router/candle-binding" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" - "github.com/vllm-project/semantic-router/semantic-router/pkg/metrics" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/metrics" ) type CategoryInference interface { diff --git a/src/semantic-router/pkg/utils/classification/classifier_test.go b/src/semantic-router/pkg/utils/classification/classifier_test.go index 8a9a5a17..a86446bc 100644 --- a/src/semantic-router/pkg/utils/classification/classifier_test.go +++ b/src/semantic-router/pkg/utils/classification/classifier_test.go @@ -8,7 +8,7 @@ import ( . "github.com/onsi/gomega" candle_binding "github.com/vllm-project/semantic-router/candle-binding" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" ) func TestClassifier(t *testing.T) { diff --git a/src/semantic-router/pkg/utils/http/response.go b/src/semantic-router/pkg/utils/http/response.go index a42193de..93a6cc4a 100644 --- a/src/semantic-router/pkg/utils/http/response.go +++ b/src/semantic-router/pkg/utils/http/response.go @@ -9,7 +9,7 @@ import ( core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" ext_proc "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3" typev3 "github.com/envoyproxy/go-control-plane/envoy/type/v3" - "github.com/vllm-project/semantic-router/semantic-router/pkg/metrics" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/metrics" ) // CreatePIIViolationResponse creates an HTTP response for PII policy violations diff --git a/src/semantic-router/pkg/utils/pii/policy.go b/src/semantic-router/pkg/utils/pii/policy.go index 3b206340..b3254a82 100644 --- a/src/semantic-router/pkg/utils/pii/policy.go +++ b/src/semantic-router/pkg/utils/pii/policy.go @@ -4,7 +4,7 @@ import ( "log" "slices" - "github.com/vllm-project/semantic-router/semantic-router/pkg/config" + "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config" ) // PolicyChecker handles PII policy validation diff --git a/website/docs/intro.md b/website/docs/intro.md index 904d70d3..908904e1 100644 --- a/website/docs/intro.md +++ b/website/docs/intro.md @@ -6,7 +6,8 @@ sidebar_position: 1 [](https://github.com/vllm-project/semantic-router/blob/main/LICENSE) [](https://huggingface.co/LLM-Semantic-Router) -[](https://goreportcard.com/report/github.com/vllm-project/semantic-router) +[](https://goreportcard.com/report/github.com/vllm-project/semantic-router/src/semantic-router) + An intelligent **Mixture-of-Models (MoM)** router that acts as an Envoy External Processor (ExtProc) to intelligently direct OpenAI API requests to the most suitable backend model from a defined pool. Using BERT-based semantic understanding and classification, it optimizes both performance and cost efficiency. diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index d5cc02cb..f1ccd448 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -1,9 +1,9 @@ // @ts-check // Note: type annotations allow type checking and IDEs autocompletion -const {themes} = require('prism-react-renderer'); -const lightCodeTheme = themes.github; -const darkCodeTheme = themes.vsDark; +const { themes } = require('prism-react-renderer') +const lightCodeTheme = themes.github +const darkCodeTheme = themes.vsDark /** @type {import('@docusaurus/types').Config} */ const config = { @@ -211,6 +211,6 @@ const config = { respectPrefersColorScheme: false, }, }), -}; +} -module.exports = config; +module.exports = config diff --git a/website/eslint.config.mjs b/website/eslint.config.mjs new file mode 100644 index 00000000..b8bb3652 --- /dev/null +++ b/website/eslint.config.mjs @@ -0,0 +1,23 @@ +import stylistic from '@stylistic/eslint-plugin' +import react from 'eslint-plugin-react' + +export default [ + { + ignores: ['.docusaurus', 'build'], + }, + stylistic.configs['recommended-flat'], + { + files: ['**/*.js', '**/*.jsx'], + plugins: { + react: react, + }, + rules: { + ...react.configs['jsx-runtime'].rules, + }, + languageOptions: { + parserOptions: { + ecmaFeatures: { jsx: true }, + }, + }, + }, +] diff --git a/website/package.json b/website/package.json index 8ec1dd13..5aa63be5 100644 --- a/website/package.json +++ b/website/package.json @@ -14,7 +14,9 @@ "clear": "docusaurus clear", "serve": "docusaurus serve", "write-translations": "docusaurus write-translations", - "write-heading-ids": "docusaurus write-heading-ids" + "write-heading-ids": "docusaurus write-heading-ids", + "lint": "eslint .", + "lint:fix": "eslint . --fix" }, "keywords": [ "llm", @@ -30,6 +32,9 @@ "@docusaurus/theme-mermaid": "^3.8.1", "@mdx-js/react": "^3.1.0", "react": "^18.3.1", - "react-dom": "^18.3.1" + "react-dom": "^18.3.1", + "@stylistic/eslint-plugin": "2.13.0", + "eslint": "9.18.0", + "eslint-plugin-react": "^7.37.4" } } diff --git a/website/sidebars.js b/website/sidebars.js index 3bf1650b..353cda9c 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -57,6 +57,6 @@ const sidebars = { ], }, ], -}; +} -module.exports = sidebars; +module.exports = sidebars diff --git a/website/src/components/AIChipAnimation.js b/website/src/components/AIChipAnimation.js index 9002e7d3..60b85599 100644 --- a/website/src/components/AIChipAnimation.js +++ b/website/src/components/AIChipAnimation.js @@ -1,25 +1,25 @@ -import React, { useEffect, useRef } from 'react'; -import styles from './AIChipAnimation.module.css'; +import React, { useEffect, useRef } from 'react' +import styles from './AIChipAnimation.module.css' const AIChipAnimation = () => { - const svgRef = useRef(null); + const svgRef = useRef(null) useEffect(() => { - const svg = svgRef.current; - if (!svg) return; + const svg = svgRef.current + if (!svg) return // Add pulsing animation to circuit paths - const paths = svg.querySelectorAll('.circuit-path'); + const paths = svg.querySelectorAll('.circuit-path') paths.forEach((path, index) => { - path.style.animationDelay = `${index * 0.2}s`; - }); + path.style.animationDelay = `${index * 0.2}s` + }) // Add data flow animation - const dataPoints = svg.querySelectorAll('.data-point'); + const dataPoints = svg.querySelectorAll('.data-point') dataPoints.forEach((point, index) => { - point.style.animationDelay = `${index * 0.3}s`; - }); - }, []); + point.style.animationDelay = `${index * 0.3}s` + }) + }, []) return (
Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
-Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate.
++ Community Impact: + {' '} + Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. +
++ Consequence: + {' '} + A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. +
Community Impact: A violation through a single incident or series of actions.
-Consequence: A warning with consequences for continued behavior. No interaction with the people involved for a specified period of time.
++ Community Impact: + {' '} + A violation through a single incident or series of actions. +
++ Consequence: + {' '} + A warning with consequences for continued behavior. No interaction with the people involved for a specified period of time. +
Community Impact: A serious violation of community standards, including sustained inappropriate behavior.
-Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time.
++ Community Impact: + {' '} + A serious violation of community standards, including sustained inappropriate behavior. +
++ Consequence: + {' '} + A temporary ban from any sort of interaction or public communication with the community for a specified period of time. +
Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
-Consequence: A permanent ban from any sort of public interaction within the community.
++ Community Impact: + {' '} + Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. +
++ Consequence: + {' '} + A permanent ban from any sort of public interaction within the community. +
- This Code of Conduct is adapted from the Contributor Covenant, - version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + This Code of Conduct is adapted from the + {' '} + Contributor Covenant + , + version 2.0, available at + {' '} + https://www.contributor-covenant.org/version/2/0/code_of_conduct.html + .
Found a bug? Please report it on our GitHub Issues.
++ Found a bug? Please report it on our + GitHub Issues + . +
Discuss your idea or bug report with the community first.
Create a new branch for your changes from the main branch.
Implement your changes following our coding standards.
Run tests and ensure your changes don't break existing functionality.
- Consider joining one of our Working Groups to focus your contributions: + Consider joining one of our + {' '} + Working Groups + {' '} + to focus your contributions:
Need help with your contribution? Reach out to us:
{member.role} - {member.company && @ {member.company}} + {member.company && ( + + {' '} + @ + {member.company} + + )}
@@ -166,11 +169,11 @@ export default function Team() {
- We believe in recognizing the valuable contributions of our community members. - Contributors who show consistent dedication and quality work in specific areas + We believe in recognizing the valuable contributions of our community members. + Contributors who show consistent dedication and quality work in specific areas may be invited to become maintainers with write access to the repository.
- +Make consistent, quality contributions to your area of interest
Participate actively in one of our Working Groups
++ Participate actively in one of our + Working Groups +
Receive nomination and approval from the maintainer team
Find your area of expertise and connect with like-minded contributors.
@@ -228,7 +234,7 @@ export default function Team() { View Work GroupsParticipate in community discussions and share your ideas.
@@ -241,5 +247,5 @@ export default function Team() {- Please comment on{' '} - GitHub Issue #15 - {' '} + + {' '} if you are interested in one or more.
- We are grateful for any contributions, and if you show consistent contributions to the above specify area, - you will be promoting as its maintainer after votes from maintainer team, and you will be invited to + We are grateful for any contributions, and if you show consistent contributions to the above specify area, + you will be promoting as its maintainer after votes from maintainer team, and you will be invited to semantic-router-maintainer group, and granted WRITE access to this repo.
area/document, area/core)area/document
+                ,
+                {' '}
+                area/core
+                )
+              For questions about working groups or to get involved:
-              ๐ง  Intelligent Auto Reasoning Router for Efficient LLM Inference on Mixture-of-Models
+              ๐ง  Intelligent
+              {' '}
+              Auto Reasoning
+              {' '}
+              Router for Efficient LLM Inference on
+              {' '}
+              Mixture-of-Models
               
               
                 ๐งฌ Neural Networks
@@ -46,13 +54,14 @@ function HomepageHeader() {
         
@@ -84,13 +87,25 @@ export default function RoadmapV01() {