buhe/langchain-swift

There are security issues with using env.txt.

Closed this issue · 1 comments

buhe commented
There are security issues with using env.txt.
buhe commented
// LangChain library
enum LangChain {
    private static var openAIAPIKey: String?
    private static var openAIBase: String?

    public static func configure(
        openAIAPIKey: String,
        openAIBase: String
        // other keys
    ) {
        self.openAIAPIKey = openAIAPIKey
        self.openAIBase = openAIBase
    }

    static func retrieveOpenAIAPIKey() -> String? {
        return openAIAPIKey
    }

    static func retrieveOpenAIBase() -> String? {
        return openAIBase
    }

    // Additional methods to get other API keys
}

// App
LangChain.configure(
    openAIAPIKey: "your-api-key",
    openAIBase: "your-api-base"
)