ProjectTech4DevAI / ProjectTech4DevAI/kaapi-backend
Remove Langfuse Dependency for Session ID Grouping in Response API
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18
- Forks
- 10
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 14
Description
Currently, in the Response API, we derive the session_id from Langfuse by querying it using the previous response_id, as shown below:
if response_id:
traces = self.langfuse.fetch_traces(tags=response_id).data
if traces:
self.session_id = traces[0].session_id
This approach introduces an unnecessary runtime dependency on Langfuse, solely to group related traces under the same session for visualization purposes.
OpenAI does not currently provide a native conversation ID for API responses, which complicates session tracking.
We are in discussions with OpenAI to potentially add support for a conversation_id or similar identifier at their end which we can pass to langfuse as session_id.
Alternative: Maintain the session or conversation-level grouping within the Glific flow context itself, so that Langfuse becomes an observer rather than a source of truth for session identity.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue identifies the Response API path and the existing Langfuse trace lookup as the entry point; no file or test is named. First map where response_id and session_id are managed, then verify that session grouping remains consistent without a runtime Langfuse lookup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend, observability
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100