Skip to content

Commit

Permalink
fix the redifinition of supported providers (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
dorbanianas authored Dec 6, 2024
1 parent 96b330a commit d37d178
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/include/flockmtl/secret_manager/secret_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ extern const SecretDetails ollama_secret_details;

class SecretManager {
public:
enum SupportedProviders { OPENAI, AZURE, OLLAMA };

static void Register(duckdb::DatabaseInstance& instance);
static std::unordered_map<std::string, std::string> GetSecret(std::string provider);
static SupportedProviders GetProviderType(std::string provider);

private:
static void RegisterSecretType(duckdb::DatabaseInstance& instance);
Expand Down
6 changes: 2 additions & 4 deletions src/secret_manager/secret_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ const SecretDetails ollama_secret_details = {"ollama", "flockmtl", "ollama://",
const std::vector<const SecretDetails*> secret_details_list = {&openai_secret_details, &azure_secret_details,
&ollama_secret_details};

enum SupportedProviders { OPENAI, AZURE, OLLAMA };

SupportedProviders GetProviderType(std::string provider) {
SecretManager::SupportedProviders SecretManager::GetProviderType(std::string provider) {
if (provider == "openai") {
return OPENAI;
} else if (provider == "azure") {
Expand Down Expand Up @@ -113,7 +111,7 @@ std::unordered_map<std::string, std::string> SecretManager::GetSecret(std::strin
const auto kv_secret = dynamic_cast<const duckdb::KeyValueSecret&>(*secret->secret);

auto provider = secret->secret->GetType();
auto providerType = GetProviderType(provider);
auto providerType = SecretManager::GetProviderType(provider);
SecretDetails secret_details;
switch (providerType) {
case SupportedProviders::OPENAI:
Expand Down

0 comments on commit d37d178

Please sign in to comment.