-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
We currently have a FastAPI background job setup for processing responses with the following function signature:
def process_response(
request: ResponsesAPIRequest,
client: OpenAI,
assistant,
tracer: LangfuseTracer,
project_id: int,
organization_id: int,
ancestor_id: str,
latest_conversation: OpenAIConversation | None,
):
There is a concern regarding the serialization and deserialization of complex arguments (e.g., dataclasses, client, and custom objects like OpenAI, LangfuseTracer, etc.). These types may not be serializable and could cause issues when we migrate to celery queues.
For Response API Only:
- To avoid issues with serialization/deserialization, we should modify the current background job function to pass only the IDs of complex objects instead of the objects themselves (e.g., pass project_id and organization_id instead of the full object).
- We will then retrieve these objects by their IDs within the background job, ensuring that serialization issues are avoided.
Additional Notes:
- If retrieving these objects from a database or cache, ensure that the necessary database queries or cache fetch operations are done at the start of the background job.
- This change should only apply to the Response API background job, as other APIs may have different serialization requirements.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Closed