Skip to content

Commit

Permalink
feat(ollama): add port and protocol to provider config
Browse files Browse the repository at this point in the history
Include port and protocol configuration options in the OllamaOpenAIProviderConfig class to enhance flexibility in specifying network settings. Modify related functions accordingly for seamless integration.
  • Loading branch information
hanrw committed Jan 3, 2025
1 parent f061a16 commit 2e400fb
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ import com.tddworks.ollama.api.OllamaConfig
import com.tddworks.openai.gateway.api.OpenAIProviderConfig

data class OllamaOpenAIProviderConfig(
val port: () -> Int = { 11434 },
val protocol: () -> String = { "http" },
override val baseUrl: () -> String = { "http//:localhost:11434" },
override val apiKey: () -> String = { "ollama-ignore-this" }
) : OpenAIProviderConfig

fun OllamaOpenAIProviderConfig.toOllamaConfig() =
OllamaConfig(baseUrl = baseUrl)
OllamaConfig(baseUrl = baseUrl, protocol = protocol, port = port)

fun OpenAIProviderConfig.Companion.ollama(
apiKey: () -> String = { "ollama-ignore-this" },
baseUrl: () -> String = { "http//:localhost:11434" },
) = OllamaOpenAIProviderConfig(baseUrl, apiKey)
baseUrl: () -> String = { "localhost" },
protocol: () -> String = { "http" },
port: () -> Int = { 11434 }
) = OllamaOpenAIProviderConfig(port, protocol, baseUrl, apiKey)

0 comments on commit 2e400fb

Please sign in to comment.