|
10 | 10 | API_HOST = os.getenv("API_HOST") |
11 | 11 |
|
12 | 12 | if API_HOST == "azure": |
13 | | - |
14 | 13 | token_provider = azure.identity.get_bearer_token_provider( |
15 | 14 | azure.identity.DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default" |
16 | 15 | ) |
|
22 | 21 | MODEL_NAME = os.getenv("AZURE_OPENAI_DEPLOYMENT") |
23 | 22 |
|
24 | 23 | elif API_HOST == "ollama": |
25 | | - |
26 | 24 | client = openai.OpenAI( |
27 | 25 | base_url=os.getenv("OLLAMA_ENDPOINT"), |
28 | 26 | api_key="nokeyneeded", |
29 | 27 | ) |
30 | 28 | MODEL_NAME = os.getenv("OLLAMA_MODEL") |
31 | 29 |
|
32 | 30 | elif API_HOST == "github": |
33 | | - |
34 | 31 | client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.getenv("GITHUB_TOKEN")) |
35 | 32 | MODEL_NAME = os.getenv("GITHUB_MODEL") |
36 | 33 |
|
37 | 34 | else: |
38 | | - |
39 | 35 | client = openai.OpenAI(api_key=os.getenv("OPENAI_KEY")) |
40 | 36 | MODEL_NAME = os.getenv("OPENAI_MODEL") |
41 | 37 |
|
42 | | -SYSTEM_MESSAGE = """ |
43 | | -You are a helpful assistant that answers questions about cars based off a hybrid car data set. |
44 | | -You must use the data set to answer the questions, you should not provide any info that is not in the provided sources. |
45 | | -""" |
46 | 38 |
|
47 | | -USER_MESSAGE = "how fast is a prius?" |
| 39 | +USER_MESSAGE = "how fast is the prius v?" |
48 | 40 |
|
49 | 41 | # Open the CSV and store in a list |
50 | 42 | with open("hybrid.csv") as file: |
|
69 | 61 | print(matches_table) |
70 | 62 |
|
71 | 63 | # Now we can use the matches to generate a response |
| 64 | +SYSTEM_MESSAGE = """ |
| 65 | +You are a helpful assistant that answers questions about cars based off a hybrid car data set. |
| 66 | +You must use the data set to answer the questions, you should not provide any info that is not in the provided sources. |
| 67 | +""" |
| 68 | + |
72 | 69 | response = client.chat.completions.create( |
73 | 70 | model=MODEL_NAME, |
74 | 71 | temperature=0.7, |
|
0 commit comments