MCPcopy Create free account
hub / github.com/chenfei-wu/TaskMatrix / __init__

Method __init__

LowCodeLLM/src/openAIWrapper.py:8–35  ·  view source on GitHub ↗
(self, temperature)

Source from the content-addressed store, hash-verified

6
7class OpenAIWrapper:
8 def __init__(self, temperature):
9 self.key = os.environ.get("OPENAIKEY")
10 openai.api_key = self.key
11
12 # Access the USE_AZURE environment variable
13 self.use_azure = os.environ.get('USE_AZURE')
14
15 # Check if USE_AZURE is defined
16 if self.use_azure is not None:
17 # Convert the USE_AZURE value to boolean
18 self.use_azure = self.use_azure.lower() == 'true'
19 else:
20 self.use_azure = False
21
22 if self.use_azure:
23 openai.api_type = "azure"
24 self.api_base = os.environ.get('API_BASE')
25 openai.api_base = self.api_base
26 self.api_version = os.environ.get('API_VERSION')
27 openai.api_version = self.api_version
28 self.engine = os.environ.get('MODEL')
29 else:
30 self.chat_model_id = "gpt-3.5-turbo"
31
32 self.temperature = temperature
33 self.max_tokens = 2048
34 self.top_p = 1
35 self.time_out = 7
36
37 def run(self, prompt):
38 return self._post_request_chat(prompt)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected