Zack Saadioui
4/24/2025
1
pip install openai
1
2
3
4
5
6
python
response = openai.responses.create(
model="gpt-4o-mini",
input="Tell me a joke!"
)
print(response.output[0].content[0].text)
1
2
3
4
5
6
7
python
response_two = openai.responses.create(
model="gpt-4o-mini",
input="Tell me another one!",
previous_response_id=response.id # This maintains the previous context.
)
print(response_two.output[0].content[0].text)
1
web_search
1
2
3
4
5
6
7
8
9
python
response_web_search = openai.responses.create(
model="gpt-4o",
input="What's the latest news on AI?",
tools=[
{"type": "web_search"}
]
)
print(json.dumps(response_web_search.output, default=lambda o: o.__dict__, indent=2))
1
temperature
Copyright © Arsturn 2025