Closed asciiwalker closed 1 month ago
same issue met
hey @EZ-hwh , Can you help here? I saw this file is excluded in .gitignore but this file import is there at a few places which is causing errors in running the mentioned command in READMe file.
hey @EZ-hwh , Can you help test the repository code? I have been able to set up the repo with requirements.txt installation successfully. Just need ms_api_copy.py file for running those command mentioned in README.md file
hey @EZ-hwh , Can you help test the repository code? I have been able to set up the repo with requirements.txt installation successfully. Just need ms_api_copy.py file for running those command mentioned in README.md file
ms_api_copy.py is just a file that just contains simple OpenAI API execution code. You can reimplement it refering to utils/api.py.
@asciiwalker Were you able to re-implement it?
Should be just like:
import openai
# Replace 'your-api-key' with your actual OpenAI API key
OPENAI_API_KEY = 'your-api-key'
openai.api_key = OPENAI_API_KEY
def ms_chatgpt(query):
query_session = [{"role":"user", "content": query}]
resp = client.chat.completions.create(
model='gpt-3.5-turbo',
messages=query_session,
temperature=0.1,
max_tokens=512,
top_p=1,
frequency_penalty=0.0,
presence_penalty=0.0,
)
ret = resp.choices[0].message.content
return ret
def ms_gpt4(query):
query_session = [{"role":"user", "content": query}]
resp = client.chat.completions.create(
model='gpt-4-1106-preview',
messages=query_session,
temperature=0.1,
max_tokens=512,
top_p=1,
frequency_penalty=0.0,
presence_penalty=0.0,
)
ret = resp.choices[0].message.content
return ret
# Example usage
if __name__ == "__main__":
print(ms_chatgpt("How do I calculate the 100th prime number in Python?"))
ModuleNotFoundError: No module named 'utils.ms_api_copy'