-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathai_util.py
30 lines (26 loc) · 1.08 KB
/
ai_util.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
from dotenv import load_dotenv
from pathlib import Path
env_path = Path(".")/".env"
load_dotenv(dotenv_path = env_path)
import openai
import helper
db = "CustomerList.csv"
system_content = "You will receive a list of Justworks' customers - these companies are using Justworks products. Some Justworks employees want to use their services/products because they trust their customers. You should recommend the related and good services. Be descriptive and helpful."
client = openai.OpenAI(
api_key = os.environ["AI_API_KEY"],
base_url = "https://api.aimlapi.com",
)
def getRecommendation(command_text):
prompt = helper.get_data_to_prompt()
prompt += f"Please recommend users the companies that do {command_text} services."
chat_completion = client.chat.completions.create(
model = "mistralai/Mistral-7B-Instruct-v0.2",
messages = [
{"role": "system", "content": system_content},
{"role": "user", "content": prompt},
],
temperature = 0.7,
max_tokens = 100,
)
return chat_completion.choices[0].message.content