MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / set_openai_api_key

Method set_openai_api_key

bmtools/agent/singletool.py:80–88  ·  view source on GitHub ↗
(self, key)

Source from the content-addressed store, hash-verified

78
79
80 def set_openai_api_key(self, key):
81 logger.info("Using {}".format(self.llm_model))
82
83 if self.llm_model == "GPT-3.5":
84 self.llm = OpenAI(temperature=0.0, openai_api_key=key) # use text-darvinci
85 elif self.llm_model == "ChatGPT":
86 self.llm = OpenAI(model_name="gpt-3.5-turbo", temperature=0.0, openai_api_key=key) # use chatgpt
87 else:
88 raise RuntimeError("Your model is not available.")
89
90 def load_tools(self, name, meta_info, prompt_type="react-with-tool-description", return_intermediate_steps=True):
91

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected