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

Class executingLLM

LowCodeLLM/src/executingLLM.py:26–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24"""
25
26class executingLLM:
27 def __init__(self, temperature) -> None:
28 self.prefix = EXECUTING_LLM_PREFIX
29 self.suffix = EXECUTING_LLM_SUFFIX
30 self.LLM = OpenAIWrapper(temperature)
31 self.messages = [{"role": "system", "content": "You are a helpful assistant."},
32 {"role": "system", "content": self.prefix}]
33
34 def execute(self, current_prompt, history):
35 ''' provide LLM the dialogue history and the current prompt to get response '''
36 messages = self.messages + history
37 messages.append({'role': 'user', "content": current_prompt + self.suffix})
38 response, status = self.LLM.run(messages)
39 if status:
40 return response
41 else:
42 return "OpenAI API error."

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected