I am building a service based on the OpenAI Assistant API. In my implementation, the assistant uses file_search
to search through uploaded .txt
files and generates responses based on the retrieved content.
For my use case, I need to reproduce the same response every time the API is executed with the same input. However, when I run the following code, I get different results each time.
run = self.client.beta.threads.runs.create_and_poll(
thread_id=thread.id,
assistant_id=self.assistant.id,
tools=[{"type": "file_search"}],
tool_choice={"type": "file_search"},
temperature=0.0,
top_p=1.0
)
Iād like to know:
-
Are there other parameters that affect response determinism, especially when using file_search?
-
Is this varying behavior expected when using the Assistant API with file search?
-
Are there any recommended approaches to achieve more consistent outputs when searching and responding based on file content?