MCPcopy Create free account
hub / github.com/FSoft-AI4Code/HyperAgent / __init__

Method __init__

src/hyperagent/agents/llms.py:75–85  ·  view source on GitHub ↗
(self, config)

Source from the content-addressed store, hash-verified

73
74class OpenAILLM(LLM):
75 def __init__(self, config):
76 super().__init__(config)
77 if "openai_api_key" in config:
78 openai_api_key = config["openai_api_key"]
79 elif "OPENAI_API_KEY" in os.environ:
80 openai_api_key = os.environ["OPENAI_API_KEY"]
81 else:
82 assert False, "OpenAI API key not found"
83 self.client = OpenAI(
84 api_key=openai_api_key,
85 )
86
87 def __call__(self, prompt: str):
88 # The line `prompt = truncate_tokens(prompt, encoding_name=self.config["model"],

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected