Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ jobs:
ELEVENLABS_API_KEY: ${{ secrets.ELEVENLABS_API_KEY }}
SGL_API_KEY: ${{ secrets.SGL_API_KEY }}
CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY }}
SARVAM_API_KEY: ${{ secrets.SARVAM_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }}
VERTEX_CREDENTIALS: ${{ secrets.VERTEX_CREDENTIALS }}
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/release-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ jobs:
PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY }}
SGL_API_KEY: ${{ secrets.SGL_API_KEY }}
CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY }}
SARVAM_API_KEY: ${{ secrets.SARVAM_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }}
VERTEX_CREDENTIALS: ${{ secrets.VERTEX_CREDENTIALS }}
Expand Down Expand Up @@ -354,6 +355,7 @@ jobs:
PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY }}
SGL_API_KEY: ${{ secrets.SGL_API_KEY }}
CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY }}
SARVAM_API_KEY: ${{ secrets.SARVAM_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }}
VERTEX_CREDENTIALS: ${{ secrets.VERTEX_CREDENTIALS }}
Expand Down Expand Up @@ -461,6 +463,7 @@ jobs:
PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY }}
SGL_API_KEY: ${{ secrets.SGL_API_KEY }}
CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY }}
SARVAM_API_KEY: ${{ secrets.SARVAM_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }}
VERTEX_CREDENTIALS: ${{ secrets.VERTEX_CREDENTIALS }}
Expand Down Expand Up @@ -747,6 +750,7 @@ jobs:
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY }}
CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY }}
SARVAM_API_KEY: ${{ secrets.SARVAM_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
PARASAIL_API_KEY: ${{ secrets.PARASAIL_API_KEY }}
ELEVENLABS_API_KEY: ${{ secrets.ELEVENLABS_API_KEY }}
Expand Down Expand Up @@ -1025,6 +1029,7 @@ jobs:
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY }}
CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY }}
SARVAM_API_KEY: ${{ secrets.SARVAM_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
PARASAIL_API_KEY: ${{ secrets.PARASAIL_API_KEY }}
ELEVENLABS_API_KEY: ${{ secrets.ELEVENLABS_API_KEY }}
Expand Down Expand Up @@ -1147,6 +1152,7 @@ jobs:
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY }}
CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY }}
SARVAM_API_KEY: ${{ secrets.SARVAM_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
PARASAIL_API_KEY: ${{ secrets.PARASAIL_API_KEY }}
ELEVENLABS_API_KEY: ${{ secrets.ELEVENLABS_API_KEY }}
Expand Down Expand Up @@ -1257,6 +1263,7 @@ jobs:
PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY }}
SGL_API_KEY: ${{ secrets.SGL_API_KEY }}
CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY }}
SARVAM_API_KEY: ${{ secrets.SARVAM_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }}
VERTEX_CREDENTIALS: ${{ secrets.VERTEX_CREDENTIALS }}
Expand Down Expand Up @@ -1370,6 +1377,7 @@ jobs:
PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY }}
SGL_API_KEY: ${{ secrets.SGL_API_KEY }}
CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY }}
SARVAM_API_KEY: ${{ secrets.SARVAM_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }}
VERTEX_CREDENTIALS: ${{ secrets.VERTEX_CREDENTIALS }}
Expand Down Expand Up @@ -1499,6 +1507,7 @@ jobs:
PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY }}
SGL_API_KEY: ${{ secrets.SGL_API_KEY }}
CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY }}
SARVAM_API_KEY: ${{ secrets.SARVAM_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }}
VERTEX_CREDENTIALS: ${{ secrets.VERTEX_CREDENTIALS }}
Expand Down
3 changes: 3 additions & 0 deletions core/bifrost.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"github.com/maximhq/bifrost/core/providers/replicate"
"github.com/maximhq/bifrost/core/providers/runware"
"github.com/maximhq/bifrost/core/providers/runway"
"github.com/maximhq/bifrost/core/providers/sarvam"
"github.com/maximhq/bifrost/core/providers/sgl"
providerUtils "github.com/maximhq/bifrost/core/providers/utils"
"github.com/maximhq/bifrost/core/providers/vertex"
Expand Down Expand Up @@ -4291,6 +4292,8 @@ func (bifrost *Bifrost) createBaseProvider(providerKey schemas.ModelProvider, co
return runware.NewRunwareProvider(config, bifrost.logger)
case schemas.Fireworks:
return fireworks.NewFireworksProvider(config, bifrost.logger)
case schemas.Sarvam:
return sarvam.NewSarvamProvider(config, bifrost.logger)
default:
return nil, fmt.Errorf("unsupported provider: %s", targetProviderKey)
}
Expand Down
10 changes: 10 additions & 0 deletions core/internal/llmtests/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ func (account *ComprehensiveTestAccount) GetConfiguredProviders() ([]schemas.Mod
schemas.Runway,
schemas.Runware,
schemas.Fireworks,
schemas.Sarvam,
ProviderOpenAICustom,
}, nil
}
Expand Down Expand Up @@ -459,6 +460,15 @@ func (account *ComprehensiveTestAccount) GetKeysForProvider(ctx context.Context,
UseForBatchAPI: bifrost.Ptr(true),
},
}, nil
case schemas.Sarvam:
return []schemas.Key{
{
Value: *schemas.NewSecretVar("env.SARVAM_API_KEY"),
Models: []string{"*"},
Weight: 1.0,
UseForBatchAPI: bifrost.Ptr(true),
},
}, nil
case schemas.DeepSeek:
return []schemas.Key{
{
Expand Down
34 changes: 34 additions & 0 deletions core/providers/sarvam/cachedcontents.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package sarvam

import (
providerUtils "github.com/maximhq/bifrost/core/providers/utils"
"github.com/maximhq/bifrost/core/schemas"
)

// CachedContentCreate is unsupported on SarvamProvider. Only Gemini and Vertex AI
// implement the cached-content lifecycle (Google AI Studio + Vertex AI named
// caches). Other providers either lack named cache management entirely or
// handle caching implicitly via per-message cache_control markers.
func (provider *SarvamProvider) CachedContentCreate(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostCachedContentCreateRequest) (*schemas.BifrostCachedContentCreateResponse, *schemas.BifrostError) {
return nil, providerUtils.NewUnsupportedOperationError(schemas.CachedContentCreateRequest, provider.GetProviderKey())
}

// CachedContentList is unsupported on SarvamProvider (see CachedContentCreate).
func (provider *SarvamProvider) CachedContentList(ctx *schemas.BifrostContext, keys []schemas.Key, request *schemas.BifrostCachedContentListRequest) (*schemas.BifrostCachedContentListResponse, *schemas.BifrostError) {
return nil, providerUtils.NewUnsupportedOperationError(schemas.CachedContentListRequest, provider.GetProviderKey())
}

// CachedContentRetrieve is unsupported on SarvamProvider (see CachedContentCreate).
func (provider *SarvamProvider) CachedContentRetrieve(ctx *schemas.BifrostContext, keys []schemas.Key, request *schemas.BifrostCachedContentRetrieveRequest) (*schemas.BifrostCachedContentRetrieveResponse, *schemas.BifrostError) {
return nil, providerUtils.NewUnsupportedOperationError(schemas.CachedContentRetrieveRequest, provider.GetProviderKey())
}

// CachedContentUpdate is unsupported on SarvamProvider (see CachedContentCreate).
func (provider *SarvamProvider) CachedContentUpdate(ctx *schemas.BifrostContext, keys []schemas.Key, request *schemas.BifrostCachedContentUpdateRequest) (*schemas.BifrostCachedContentUpdateResponse, *schemas.BifrostError) {
return nil, providerUtils.NewUnsupportedOperationError(schemas.CachedContentUpdateRequest, provider.GetProviderKey())
}

// CachedContentDelete is unsupported on SarvamProvider (see CachedContentCreate).
func (provider *SarvamProvider) CachedContentDelete(ctx *schemas.BifrostContext, keys []schemas.Key, request *schemas.BifrostCachedContentDeleteRequest) (*schemas.BifrostCachedContentDeleteResponse, *schemas.BifrostError) {
return nil, providerUtils.NewUnsupportedOperationError(schemas.CachedContentDeleteRequest, provider.GetProviderKey())
}
24 changes: 24 additions & 0 deletions core/providers/sarvam/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package sarvam

import (
providerUtils "github.com/maximhq/bifrost/core/providers/utils"
schemas "github.com/maximhq/bifrost/core/schemas"
"github.com/valyala/fasthttp"
)

// parseSarvamError converts a non-2xx Sarvam response into a BifrostError,
// preferring Sarvam's structured error message/code when available.
func parseSarvamError(resp *fasthttp.Response) *schemas.BifrostError {
var errorResp SarvamError
bifrostErr := providerUtils.HandleProviderAPIError(resp, &errorResp)
if msg := errorResp.Message(); msg != "" {
if bifrostErr.Error == nil {
bifrostErr.Error = &schemas.ErrorField{}
}
bifrostErr.Error.Message = msg
if code := errorResp.Code(); code != "" {
bifrostErr.Error.Type = schemas.Ptr(code)
}
}
return bifrostErr
}
Loading