Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- fix: add json serialization support for neo4j sdk types
[#699](https://github.com/hypermodeinc/modus/pull/699)
- chore: update api-explorer to react 19 [#700](https://github.com/hypermodeinc/modus/pull/700)
- chore: remove localHypermodeModels list and handle 404s properly instead in local dev
[#703](https://github.com/hypermodeinc/modus/pull/703)
- fix: remove fallback to default time zone [#706](https://github.com/hypermodeinc/modus/pull/706)

## 2025-01-09 - CLI 0.16.6
Expand Down
13 changes: 0 additions & 13 deletions runtime/models/hypermode.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ func getHypermodeModelEndpointUrl(model *manifest.ModelInfo) (string, error) {
// In development, use the shared Hypermode model server.
// Note: Authentication via the Hypermode CLI is required.
if config.IsDevEnvironment() {
if _, ok := localHypermodeModels[strings.ToLower(model.SourceModel)]; !ok {
return "", fmt.Errorf("model %s is not available in the local dev environment", model.SourceModel)
}
endpoint := fmt.Sprintf("https://models.hypermode.host/%s", strings.ToLower(model.SourceModel))
return endpoint, nil
}
Expand All @@ -55,13 +52,3 @@ func authenticateHypermodeModelRequest(ctx context.Context, req *http.Request, c
// In production, the Hypermode infrastructure protects the model server.
return nil
}

// cSpell:disable
// These are the Hypermode models that are available in the local dev environment.
// This list may be updated as new models are added.
var localHypermodeModels = map[string]bool{
"meta-llama/meta-llama-3.1-8b-instruct": true,
"sentence-transformers/all-minilm-l6-v2": true,
"antoinemc/distilbart-mnli-github-issues": true,
"distilbert/distilbert-base-uncased-finetuned-sst-2-english": true,
}
9 changes: 9 additions & 0 deletions runtime/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ package models

import (
"context"
"errors"
"fmt"
"net/http"
"strings"

"github.com/hypermodeinc/modus/lib/manifest"
"github.com/hypermodeinc/modus/runtime/config"
"github.com/hypermodeinc/modus/runtime/db"
"github.com/hypermodeinc/modus/runtime/httpclient"
"github.com/hypermodeinc/modus/runtime/manifestdata"
Expand Down Expand Up @@ -89,6 +91,13 @@ func PostToModelEndpoint[TResult any](ctx context.Context, model *manifest.Model
res, err := utils.PostHttp[TResult](ctx, url, payload, bs)
if err != nil {
var empty TResult
var httpe *utils.HttpError
if errors.As(err, &httpe) {
if config.IsDevEnvironment() && httpe.StatusCode == http.StatusNotFound {
return empty, fmt.Errorf("model %s is not available in the local dev environment", model.SourceModel)
}
}

return empty, err
}

Expand Down
19 changes: 17 additions & 2 deletions runtime/utils/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ import (

var httpClient = &http.Client{}

type HttpError struct {
StatusCode int
Message string
}

func (e *HttpError) Error() string {
return "HTTP error: " + e.Message
}

func HttpClient() *http.Client {
return httpClient
}
Expand All @@ -38,9 +47,15 @@ func sendHttp(req *http.Request) ([]byte, error) {

if response.StatusCode != http.StatusOK {
if len(body) == 0 {
return nil, fmt.Errorf("HTTP error: %s", response.Status)
return nil, &HttpError{
StatusCode: response.StatusCode,
Message: response.Status,
}
} else {
return nil, fmt.Errorf("HTTP error: %s\n%s", response.Status, body)
return nil, &HttpError{
StatusCode: response.StatusCode,
Message: fmt.Sprintf("%s\n%s", response.Status, body),
}
}
}

Expand Down
Loading