Skip to content

Commit c7de0ec

Browse files
authored
Merge pull request #10 from pamelafox/httpdemos
Add RAG HTTP demo
2 parents 981bcde + 6baa4f0 commit c7de0ec

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

http/azure_openai.http renamed to http/chat_completion.http

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Authorization: Bearer {{$dotenv TOKEN}}
33
Content-Type: application/json
44

55
{
6-
"messages": [{"role":"system","content":"You are an AI assistant that loves emojis."},
7-
{"role":"user","content":"What is the capital of France?"}],
6+
"messages": [{"role":"system","content":"You are an AI assistant that answers questions with short clear answers."},
7+
{"role":"user","content":"How fast is the Prius V?"}],
88
"max_tokens": 800,
99
"temperature": 0.7,
1010
"frequency_penalty": 0,

http/rag_hybrid.http

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
POST https://{{$dotenv SERVICE}}.openai.azure.com/openai/deployments/{{$dotenv DEPLOYMENT}}/chat/completions?api-version=2024-02-15-preview
2+
Authorization: Bearer {{$dotenv TOKEN}}
3+
Content-Type: application/json
4+
5+
{
6+
"messages": [
7+
{
8+
"role":"system",
9+
"content":"You are a helpful assistant that answers questions about cars based off a hybrid car data set. You must use the data set to answer the questions, you should not provide any info that is not in the provided sources. Sources are provided as a Markdown table. Refer to the row where you found your answer inside square brackets."
10+
},
11+
{"role":"user",
12+
"content": "How fast is the Prius V?\n\nSources: vehicle | year | msrp | acceleration | mpg | class\n --- | --- | --- | --- | --- | --- |\nPrius (1st Gen) | 1997 | 24509.74 | 7.46 | 41.26 | Compact|\nPrius (2nd Gen) | 2000 | 26832.25 | 7.97 | 45.23 | Compact|\nPrius | 2004 | 20355.64 | 9.9 | 46.0 | Midsize|\nPrius (3rd Gen) | 2009 | 24641.18 | 9.6 | 47.98 | Compact|\nPrius alpha (V) | 2011 | 30588.35 | 10.0 | 72.92 | Midsize|\nPrius V | 2011 | 27272.28 | 9.51 | 32.93 | Midsize|\n Prius C | 2012 | 19006.62 | 9.35 | 50.0 | Compact|\n Prius PHV | 2012 | 32095.61 | 8.82 | 50.0 | Midsize|\n Prius C | 2013 | 19080.0 | 8.7 | 50.0 | Compact|\n Prius | 2013 | 24200.0 | 10.2 | 50.0 | Midsize|\n Prius Plug-in | 2013 | 32000.0 | 9.17 | 50.0 | Midsize"
13+
}
14+
],
15+
"max_tokens": 800,
16+
"temperature": 0.7,
17+
"frequency_penalty": 0,
18+
"presence_penalty": 0,
19+
"top_p": 0.95,
20+
"stop": null
21+
}

retrieval_augmented_generation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969
response = client.chat.completions.create(
7070
model=MODEL_NAME,
71-
temperature=0.7,
71+
temperature=0.3,
7272
messages=[
7373
{"role": "system", "content": SYSTEM_MESSAGE},
7474
{"role": "user", "content": USER_MESSAGE + "\nSources: " + matches_table},

0 commit comments

Comments
 (0)