Skip to content
Merged
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
12 changes: 10 additions & 2 deletions core/providers/ollama/ollama.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,16 @@ func (provider *OllamaProvider) TextCompletionStream(ctx *schemas.BifrostContext
if bifrostErr != nil {
return nil, bifrostErr
}
var authHeader map[string]string
if key.Value.GetValue() != "" {
authHeader = map[string]string{"Authorization": "Bearer " + key.Value.GetValue()}
}
return openai.HandleOpenAITextCompletionStreaming(
ctx,
provider.streamingClient,
baseURL+providerUtils.GetPathFromContext(ctx, "/v1/completions"),
request,
nil,
authHeader,
Comment thread
akshaydeo marked this conversation as resolved.
Comment thread
akshaydeo marked this conversation as resolved.
provider.networkConfig.ExtraHeaders,
provider.networkConfig.StreamIdleTimeoutInSeconds,
providerUtils.ShouldSendBackRawRequest(ctx, provider.sendBackRawRequest),
Expand Down Expand Up @@ -204,13 +208,17 @@ func (provider *OllamaProvider) ChatCompletionStream(ctx *schemas.BifrostContext
if bifrostErr != nil {
return nil, bifrostErr
}
var authHeader map[string]string
if key.Value.GetValue() != "" {
authHeader = map[string]string{"Authorization": "Bearer " + key.Value.GetValue()}
}
// Use shared OpenAI-compatible streaming logic
return openai.HandleOpenAIChatCompletionStreaming(
ctx,
provider.streamingClient,
baseURL+providerUtils.GetPathFromContext(ctx, "/v1/chat/completions"),
request,
nil,
authHeader,
provider.networkConfig.ExtraHeaders,
provider.networkConfig.StreamIdleTimeoutInSeconds,
providerUtils.ShouldSendBackRawRequest(ctx, provider.sendBackRawRequest),
Expand Down
Loading