File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -130,22 +130,22 @@ LLM output is fuzzy. Define quality like this:
130
130
131
131
``` python
132
132
import os
133
+
133
134
from openai import OpenAI
134
135
135
- client = OpenAI(api_key = os.getenv(" OPENAI_API_KEY" ))
136
+ client = OpenAI(
137
+ api_key = os.environ.get(" OPENAI_API_KEY" ),
138
+ )
136
139
137
140
response = client.chat.completions.create(
138
- messages = [
139
- {
140
- " content" : " You are a concise technical writer." ,
141
- " role" : " system"
142
- },
143
- {
144
- " content" : " Explain what a vector database is in simple terms." ,
145
- " role" : " user"
146
- }
147
- ],
148
- model = " gpt-4" ,
141
+ model = " gpt-4o" ,
142
+ messages = [
143
+ {" role" : " system" , " content" : " You are a concise technical writer." },
144
+ {
145
+ " role" : " user" ,
146
+ " content" : " Explain what a vector database is in simple terms." ,
147
+ },
148
+ ],
149
149
)
150
150
151
151
print (response.choices[0 ].message.content)
You can’t perform that action at this time.
0 commit comments