Skip to content

Conversation

@nishika26
Copy link
Collaborator

@nishika26 nishika26 commented May 6, 2025

Summary

Target issue is #172

Notes

New Endpoints
1. POST /threads/start
Purpose: Initiates an OpenAI thread with the user question and starts processing in a background task.

Behavior:

  • Sets up a new thread (or reuses an existing one).

  • Saves the thread_id and question in the ThreadResponse table.

  • Begins polling in the background and stores the result once complete.

  • Returns thread_id and status as processing.

2. GET /threads/result/{thread_id}
Purpose: Fetches the result of a thread by its thread_id.

Behavior:

  • If the thread is still being processed, returns status processing.

  • If the message is available, returns it along with status success.

Extra : Needed to make small changes in "test creds" file as well, as CI check was failing because of it

@codecov
Copy link

codecov bot commented May 6, 2025

Codecov Report

Attention: Patch coverage is 77.47748% with 50 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
backend/app/tests/api/routes/test_threads.py 69.74% 36 Missing ⚠️
backend/app/api/routes/threads.py 66.66% 14 Missing ⚠️

📢 Thoughts on this report? Let us know!

@nishika26 nishika26 requested review from AkhileshNegi and jerome-white and removed request for jerome-white May 9, 2025 06:59
Copy link
Contributor

@jerome-white jerome-white left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comments are mostly stylistic; no show stoppers


@patch("app.api.routes.threads.OpenAI")
def test_poll_run_and_prepare_response_completed(mock_openai, db):
mock_client = MagicMock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now this is okay, but consider using the OpenAI mock library: https://mharrisb1.github.io/openai-responses-python/ In addition to their examples, the see the collections CRUD tests for more

@nishika26 nishika26 self-assigned this May 9, 2025
@nishika26 nishika26 added the enhancement New feature or request label May 9, 2025
@nishika26 nishika26 moved this to In Progress in Kaapi-dev May 12, 2025
Comment on lines 9 to 14
def session():
"""Creates a new in-memory database session for each test."""
engine = create_engine("sqlite://", echo=False)
SQLModel.metadata.create_all(engine)
with Session(engine) as session:
yield session
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need sqlite or we need something related to postgresql for testcases

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, I did not realize that I left a redundant code block

@AkhileshNegi AkhileshNegi merged commit a3be786 into main May 13, 2025
1 of 2 checks passed
@AkhileshNegi AkhileshNegi deleted the feature/dalgo_migration branch May 13, 2025 07:46
@nishika26 nishika26 moved this from In Progress to Closed in Kaapi-dev May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

4 participants