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
2 changes: 2 additions & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ jobs:
VERTEX_CREDENTIALS: ${{ secrets.VERTEX_CREDENTIALS }}
VERTEX_PROJECT_ID: ${{ secrets.VERTEX_PROJECT_ID }}
HUGGING_FACE_API_KEY: ${{ secrets.HUGGING_FACE_API_KEY }}
REPLICATE_API_KEY: ${{ secrets.REPLICATE_API_KEY }}
REPLICATE_OWNER : ${{ secrets.REPLICATE_OWNER }}
run: |
echo "Running tests for PR #${{ github.event.pull_request.number || 'manual run' }}"
./.github/workflows/scripts/run-tests.sh
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/release-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ jobs:
HUGGING_FACE_API_KEY: ${{ secrets.HUGGING_FACE_API_KEY }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_BEDROCK_ROLE_ARN: ${{ secrets.AWS_BEDROCK_ROLE_ARN }}
REPLICATE_API_KEY: ${{ secrets.REPLICATE_API_KEY }}
REPLICATE_OWNER: ${{ secrets.REPLICATE_OWNER }}
run: ./.github/workflows/scripts/release-core.sh "${{ needs.detect-changes.outputs.core-version }}"

framework-release:
Expand Down Expand Up @@ -551,6 +553,8 @@ jobs:
VERTEX_PROJECT_ID: ${{ secrets.VERTEX_PROJECT_ID }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
HUGGING_FACE_API_KEY: ${{ secrets.HUGGING_FACE_API_KEY }}
REPLICATE_API_KEY: ${{ secrets.REPLICATE_API_KEY }}
REPLICATE_OWNER: ${{ secrets.REPLICATE_OWNER }}
run: ./.github/workflows/scripts/release-framework.sh "${{ needs.detect-changes.outputs.framework-version }}"

plugins-release:
Expand Down Expand Up @@ -648,6 +652,8 @@ jobs:
VERTEX_PROJECT_ID: ${{ secrets.VERTEX_PROJECT_ID }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
HUGGING_FACE_API_KEY: ${{ secrets.HUGGING_FACE_API_KEY }}
REPLICATE_API_KEY: ${{ secrets.REPLICATE_API_KEY }}
REPLICATE_OWNER: ${{ secrets.REPLICATE_OWNER }}
run: ./.github/workflows/scripts/release-all-plugins.sh '${{ needs.detect-changes.outputs.changed-plugins }}'

bifrost-http-release:
Expand Down Expand Up @@ -746,6 +752,8 @@ jobs:
VERTEX_PROJECT_ID: ${{ secrets.VERTEX_PROJECT_ID }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
HUGGING_FACE_API_KEY: ${{ secrets.HUGGING_FACE_API_KEY }}
REPLICATE_API_KEY: ${{ secrets.REPLICATE_API_KEY }}
REPLICATE_OWNER: ${{ secrets.REPLICATE_OWNER }}
run: ./.github/workflows/scripts/release-bifrost-http.sh "${{ needs.detect-changes.outputs.transport-version }}"

# Docker build amd64
Expand Down
10 changes: 9 additions & 1 deletion core/bifrost.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/maximhq/bifrost/core/providers/openrouter"
"github.com/maximhq/bifrost/core/providers/parasail"
"github.com/maximhq/bifrost/core/providers/perplexity"
"github.com/maximhq/bifrost/core/providers/replicate"
"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 @@ -3088,6 +3089,8 @@ func (bifrost *Bifrost) createBaseProvider(providerKey schemas.ModelProvider, co
return huggingface.NewHuggingFaceProvider(config, bifrost.logger), nil
case schemas.XAI:
return xai.NewXAIProvider(config, bifrost.logger)
case schemas.Replicate:
return replicate.NewReplicateProvider(config, bifrost.logger)
default:
return nil, fmt.Errorf("unsupported provider: %s", targetProviderKey)
}
Expand Down Expand Up @@ -5374,6 +5377,11 @@ func (bifrost *Bifrost) selectKeyFromProviderForModel(ctx *schemas.BifrostContex
if len(key.VertexKeyConfig.Deployments) > 0 {
_, deploymentSupported = key.VertexKeyConfig.Deployments[model]
}
} else if baseProviderType == schemas.Replicate && key.ReplicateKeyConfig != nil {
// For Replicate, check if deployment exists for this model
if len(key.ReplicateKeyConfig.Deployments) > 0 {
_, deploymentSupported = key.ReplicateKeyConfig.Deployments[model]
}
}

if modelSupported && deploymentSupported {
Expand All @@ -5382,7 +5390,7 @@ func (bifrost *Bifrost) selectKeyFromProviderForModel(ctx *schemas.BifrostContex
}
}
if len(supportedKeys) == 0 {
if baseProviderType == schemas.Azure || baseProviderType == schemas.Bedrock || baseProviderType == schemas.Vertex {
if baseProviderType == schemas.Azure || baseProviderType == schemas.Bedrock || baseProviderType == schemas.Vertex || baseProviderType == schemas.Replicate {
return schemas.Key{}, fmt.Errorf("no keys found that support model/deployment: %s", model)
}
return schemas.Key{}, fmt.Errorf("no keys found that support model: %s", model)
Expand Down
1 change: 1 addition & 0 deletions core/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
- fix: **Bedrock: Stop reason conversion** - Created dedicated Bedrock stop reason converter instead of reusing Anthropic's, properly handling Bedrock-specific reasons like `guardrail_intervened` and `content_filtered`
- fix: **Bedrock: ToolChoice auto handling** - Return `nil` for `auto` tool choice (Bedrock's default) instead of failing
- fix: **Bedrock: Stop reason mapping** - Now uses own `bedrockFinishReasonToBifrost` map with Bedrock-specific stop reasons (`guardrail_intervened` -> `content_filter`, `content_filtered` -> `content_filter`)
feat: added support for replicate provider
51 changes: 51 additions & 0 deletions core/internal/llmtests/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ func (account *ComprehensiveTestAccount) GetConfiguredProviders() ([]schemas.Mod
schemas.HuggingFace,
schemas.Nebius,
schemas.XAI,
schemas.Replicate,
ProviderOpenAICustom,
}, nil
}
Expand Down Expand Up @@ -401,6 +402,15 @@ func (account *ComprehensiveTestAccount) GetKeysForProvider(ctx context.Context,
UseForBatchAPI: bifrost.Ptr(true),
},
}, nil
case schemas.Replicate:
return []schemas.Key{
{
Value: *schemas.NewEnvVar("env.REPLICATE_API_KEY"),
Models: []string{},
Weight: 1.0,
UseForBatchAPI: bifrost.Ptr(true),
},
}, nil
default:
return nil, fmt.Errorf("unsupported provider: %s", providerKey)
}
Expand Down Expand Up @@ -685,6 +695,19 @@ func (account *ComprehensiveTestAccount) GetConfigForProvider(providerKey schema
BufferSize: 10,
},
}, nil
case schemas.Replicate:
return &schemas.ProviderConfig{
NetworkConfig: schemas.NetworkConfig{
DefaultRequestTimeoutInSeconds: 300,
MaxRetries: 10,
RetryBackoffInitial: 1 * time.Second,
RetryBackoffMax: 12 * time.Second,
},
ConcurrencyAndBufferSize: schemas.ConcurrencyAndBufferSize{
Concurrency: Concurrency,
BufferSize: 10,
},
}, nil
default:
return nil, fmt.Errorf("unsupported provider: %s", providerKey)
}
Expand Down Expand Up @@ -1257,4 +1280,32 @@ var AllProviderConfigs = []ComprehensiveTestConfig{
ListModels: true,
},
},
{
Provider: schemas.Replicate,
ChatModel: "openai/gpt-4.1-mini",
TextModel: "openai/gpt-4.1-mini",
ImageGenerationModel: "black-forest-labs/flux-dev",
Scenarios: TestScenarios{
TextCompletion: false, // Not typical
SimpleChat: true,
CompletionStream: true,
MultiTurnConversation: true,
ToolCalls: true,
MultipleToolCalls: true,
End2EndToolCalling: true,
AutomaticFunctionCall: true,
ImageURL: true,
ImageBase64: true,
MultipleImages: true,
CompleteEnd2End: true,
SpeechSynthesis: false, // Not supported
SpeechSynthesisStream: false, // Not supported
Transcription: false, // Not supported
TranscriptionStream: false, // Not supported
Embedding: false, // Not supported
ListModels: true,
ImageGeneration: true,
ImageGenerationStream: false,
},
},
}
5 changes: 3 additions & 2 deletions core/internal/llmtests/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -1028,8 +1028,9 @@ func RunFileContentTest(t *testing.T, client *bifrost.Bifrost, ctx context.Conte

response, err := WithFileContentTestRetry(t, fileContentRetryConfig, contentRetryContext, contentExpectations, "FileContent", func() (*schemas.BifrostFileContentResponse, *schemas.BifrostError) {
contentRequest := &schemas.BifrostFileContentRequest{
Provider: testConfig.Provider,
FileID: uploadResponse.ID,
Provider: testConfig.Provider,
FileID: uploadResponse.ID,
ExtraParams: testConfig.FileExtraParams,
}
bfCtx := schemas.NewBifrostContext(ctx, schemas.NoDeadline)
return client.FileContentRequest(bfCtx, contentRequest)
Expand Down
Loading
Loading