1- from mlxLLM import MlxLLM
21from search import *
3- #from mlxLLM_local import MlxLLM_local
42import requests
5- from ollamaClient import OllamaClient
63from mlxClient import MlxClient
4+ from ollamaOpenAIClient import OllamaOpenAPIClient
75
8- oChatClient = OllamaClient ()
9- oSearchClient = OllamaClient ()
6+ oChatClient = OllamaOpenAPIClient ()
7+ oSearchClient = OllamaOpenAPIClient ()
108
119mChatClient = MlxClient ()
1210mSearchClient = MlxClient ()
@@ -70,39 +68,4 @@ def firePrompt(prompt: str, model: str="dolphin-mistral:latest", temp=0.4, isMlx
7068 except Exception as e :
7169 return f'Generic Error Occured { e } ' , ""
7270
73- return response , keywords
74-
75-
76-
77-
78-
79- # def firePrompt1(prompt: str, model: str="dolphin-mistral:latest", temp=0.4, isMlx=False, chat_mode=False) -> str:
80- # res = ""
81- # keywords = ""
82- # if chat_mode:
83- # if isMlx:
84- # llm = MlxLLM(model=model, temp=temp)
85- # #llm = OllamaClient()
86- # #llm = MlxLLM_local(model=model, temp=temp)
87- # else:
88- # #llm = Ollama(model=model,
89- # # temperature=temp
90- # # )
91- # llm = OllamaClient()
92- # try:
93- # #res = llm.invoke(prompt)
94- # res = llm.chat(model=model, temp=temp, prompt=prompt)
95- # except requests.exceptions.ConnectionError as e:
96- # err_str = f'PyOMlX' if isMlx else f'Ollama'
97- # return f'Unable to connect to {err_str}. Is it running?🤔', ""
98- # except Exception as e:
99- # return f'Generic Error Occured {e}', ""
100- # else:
101- # try:
102- # if isMlx:
103- # res = f'Search not implemented for MlX models. Stay tuned!'
104- # else:
105- # res, keywords = retSearchResults(model=model, search_str=prompt, temp=temp)
106- # except Exception as e:
107- # return f'__Generic Error Occured__ {e}', ""
108- # return res, keywords
71+ return response , keywords
0 commit comments