Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Commit d7bc852

Browse files
chore: add meta-llama/llama-3.2-3b-instruct to localHypermodeModels (#703)
1 parent 53ce35e commit d7bc852

File tree

4 files changed

+28
-15
lines changed

4 files changed

+28
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
- fix: add json serialization support for neo4j sdk types
77
[#699](https://github.com/hypermodeinc/modus/pull/699)
88
- chore: update api-explorer to react 19 [#700](https://github.com/hypermodeinc/modus/pull/700)
9+
- chore: remove localHypermodeModels list and handle 404s properly instead in local dev
10+
[#703](https://github.com/hypermodeinc/modus/pull/703)
911
- fix: remove fallback to default time zone [#706](https://github.com/hypermodeinc/modus/pull/706)
1012

1113
## 2025-01-09 - CLI 0.16.6

runtime/models/hypermode.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ func getHypermodeModelEndpointUrl(model *manifest.ModelInfo) (string, error) {
2727
// In development, use the shared Hypermode model server.
2828
// Note: Authentication via the Hypermode CLI is required.
2929
if config.IsDevEnvironment() {
30-
if _, ok := localHypermodeModels[strings.ToLower(model.SourceModel)]; !ok {
31-
return "", fmt.Errorf("model %s is not available in the local dev environment", model.SourceModel)
32-
}
3330
endpoint := fmt.Sprintf("https://models.hypermode.host/%s", strings.ToLower(model.SourceModel))
3431
return endpoint, nil
3532
}
@@ -55,13 +52,3 @@ func authenticateHypermodeModelRequest(ctx context.Context, req *http.Request, c
5552
// In production, the Hypermode infrastructure protects the model server.
5653
return nil
5754
}
58-
59-
// cSpell:disable
60-
// These are the Hypermode models that are available in the local dev environment.
61-
// This list may be updated as new models are added.
62-
var localHypermodeModels = map[string]bool{
63-
"meta-llama/meta-llama-3.1-8b-instruct": true,
64-
"sentence-transformers/all-minilm-l6-v2": true,
65-
"antoinemc/distilbart-mnli-github-issues": true,
66-
"distilbert/distilbert-base-uncased-finetuned-sst-2-english": true,
67-
}

runtime/models/models.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ package models
1111

1212
import (
1313
"context"
14+
"errors"
1415
"fmt"
1516
"net/http"
1617
"strings"
1718

1819
"github.com/hypermodeinc/modus/lib/manifest"
20+
"github.com/hypermodeinc/modus/runtime/config"
1921
"github.com/hypermodeinc/modus/runtime/db"
2022
"github.com/hypermodeinc/modus/runtime/httpclient"
2123
"github.com/hypermodeinc/modus/runtime/manifestdata"
@@ -89,6 +91,13 @@ func PostToModelEndpoint[TResult any](ctx context.Context, model *manifest.Model
8991
res, err := utils.PostHttp[TResult](ctx, url, payload, bs)
9092
if err != nil {
9193
var empty TResult
94+
var httpe *utils.HttpError
95+
if errors.As(err, &httpe) {
96+
if config.IsDevEnvironment() && httpe.StatusCode == http.StatusNotFound {
97+
return empty, fmt.Errorf("model %s is not available in the local dev environment", model.SourceModel)
98+
}
99+
}
100+
92101
return empty, err
93102
}
94103

runtime/utils/http.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ import (
2020

2121
var httpClient = &http.Client{}
2222

23+
type HttpError struct {
24+
StatusCode int
25+
Message string
26+
}
27+
28+
func (e *HttpError) Error() string {
29+
return "HTTP error: " + e.Message
30+
}
31+
2332
func HttpClient() *http.Client {
2433
return httpClient
2534
}
@@ -38,9 +47,15 @@ func sendHttp(req *http.Request) ([]byte, error) {
3847

3948
if response.StatusCode != http.StatusOK {
4049
if len(body) == 0 {
41-
return nil, fmt.Errorf("HTTP error: %s", response.Status)
50+
return nil, &HttpError{
51+
StatusCode: response.StatusCode,
52+
Message: response.Status,
53+
}
4254
} else {
43-
return nil, fmt.Errorf("HTTP error: %s\n%s", response.Status, body)
55+
return nil, &HttpError{
56+
StatusCode: response.StatusCode,
57+
Message: fmt.Sprintf("%s\n%s", response.Status, body),
58+
}
4459
}
4560
}
4661

0 commit comments

Comments
 (0)