Skip to content

明明有API_KEY,为何还报错:[main.py:251] - [Summary] translate failed: Did not find llm_api_key, please add an environment variable LLM_API_KEY which contains it, or pass llm_api_key as a named parameter. #7

Description

@bingjiw

config.json中明明有API_KEY,为何还报错:[main.py:251] - [Summary] translate failed: Did not find llm_api_key, please add an environment variable LLM_API_KEY which contains it, or pass llm_api_key as a named parameter.

请问以下函数在 bot.run 时到底 是调用哪个大模型model?为什么只要给一个api_key,不用指定大模型的名称吗?
万一它要调用的model不在我的api_key的支持范围内呢?

def _translate_text_to_commands(self, text):
    llm = ModelFactory().create_llm_model(**build_model_params({
        "openai_api_key": conf().get("open_ai_api_key", ""),
        "proxy": conf().get("proxy", ""),
    }))

    prompt = PromptTemplate(
        input_variables=["input"],
        template=TRANSLATE_PROMPT,
    )
    bot = LLMChain(llm=llm, prompt=prompt)
    content = bot.run(text)
    return content

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions