Find answers from the community

Updated 4 months ago

so trying to run a simple call to OpenAI

At a glance

A community member is trying to use the OpenAI API to generate a random word, but the response is always the same word "Serendipity". Other community members suggest this might be due to caching in the OpenAI API. When the community member tries to generate two random words, the response is different each time. However, the issue of getting a new random word each time for a single-word request remains unresolved.

so trying to run a simple call to OpenAI API inside a workflow. however the query always return the same result even though I want to be random
llm = OpenAI(model="gpt-4o-mini", temperature=0.8)
response = await llm.acomplete("Pick a random word. ONLY RETURN THE WORD")
how can I turn off this behavior and get a new word each time this run?
L
a
3 comments
huh, I don't actually know whats up there. Maybe some weird caching in OpenAI's API?

However:

Plain Text
>>> llm = OpenAI(model="gpt-4o-mini", temperature=0.8)
>>> resp = str(llm.complete("Pick a random word. ONLY RETURN THE WORD"))
>>> print(resp)
Serendipity
>>> resp = str(llm.complete("Pick a random word. ONLY RETURN THE WORD"))
>>> print(resp)
Serendipity
>>> resp = str(llm.complete("Pick a random word. ONLY RETURN THE WORD"))
>>> print(resp)
Serendipity


But then if I change it to ask for two words

Plain Text
>>> resp = str(llm.complete("Pick two random word. ONLY RETURN THE WORDs"))
>>> print(resp)
Serene Chaos
>>> resp = str(llm.complete("Pick two random word. ONLY RETURN THE WORDs"))
>>> print(resp)
Pineapple, Clock
>>> resp = str(llm.complete("Pick two random word. ONLY RETURN THE WORDs"))
>>> print(resp)
Emerald
Quasar
>>> 
I think this might be a specific case when asking for a single word? Idk, strange
yeah I got Serendipity too πŸ™‚ tks for looking at it
Add a reply
Sign up and join the conversation on Discord