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

Method set_openai_api_key

bmtools/agent/tools_controller.py:45–52  ·  view source on GitHub ↗
(self, key)

Source from the content-addressed store, hash-verified

43 self.load_tools(all_tools)
44
45 def set_openai_api_key(self, key):
46 logger.info("Using {}".format(self.llm_model))
47 if self.llm_model == "GPT-3.5":
48 self.llm = OpenAI(temperature=0.0, openai_api_key=key) # use text-darvinci
49 elif self.llm_model == "ChatGPT":
50 self.llm = OpenAI(model_name="gpt-3.5-turbo", temperature=0.0, openai_api_key=key) # use chatgpt
51 else:
52 raise RuntimeError("Your model is not available.")
53
54 def load_tools(self, all_tools):
55 logger.info("All tools: {}".format(all_tools))

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected