Skip to content

Conversation

Xiao-zhen-Liu
Copy link
Contributor

@Xiao-zhen-Liu Xiao-zhen-Liu commented Oct 15, 2025

Purpose

Refer to #3915 for the design and plan of adding the new chat assistant service.

This PR adds the basic project skeleton for the backend web server of chat assistant service. Within the scope of this PR, the service only provides a health check endpoint. It sets up the proper structure for subsequent PRs, which will add WebSocket communication, LLM agent orchestration, etc.

Changes

Project Configuration:

  • Add pyproject.toml with configurations for linter and formatter, and pytest. We use this file as a central place for tool configs.
  • Add requirements.txt with dependencies needed for this PR (FastAPI, Uvicorn, pytest). Subsequent PRs will gradually add more dependencies.
  • Configure Python 3.12 as target version

Backend Service:

  • Add FastAPI application with health check endpoint at /api/healthcheck
  • Add service entry point with Uvicorn server (port 8001)

Testing:

  • Add unit tests for app creation and health check endpoint
  • Tests use pytest with FastAPI TestClient

CI:

  • Add a new GitHub Actions job chat_assistant_service to build pipeline.
  • Runs the formatter, linter and unit tests.

Project Structure

chat-assistant-service/
  ├── src/
  │   ├── main.py  # Entry point of the service
  │   └── app/
  │       ├── __init__.py
  │       └── create_app.py  # FastAPI app factory
  │
  ├── tests/          # Unit tests
  │   └── app/
  │       └── test_health_check.py
  │
  ├── requirements.txt  # Dependencies
  ├── pyproject.toml  # Only used for Black (formatter) and Flake8 (linter) configurations
  ├── pytest.ini           # pytest configurations

Testing Locally

Expected behavior: the new web server works and healtcheck is successful.

Step 1: Configure environment and dependencies

  • Create and activate a new python virtual environment for this microservice (e.g., name it texera-chat-assistant-service) with Python version >= 3.12
  • Inside ./chat-assistant-service, run pip install -r requirements.txt

Step 2: Run Service

  • Inside ./chat-assistant-service/src, Execute python main.py, and the new web server will run locally on http://localhost:8001

Step 3: Test Health Check

  • In another terminal, execute curl http://localhost:8001/api/healthcheck. You can also visit http://localhost:8001/api/healthcheck in browser.
  • Expected output: {"status":"ok"}

@github-actions github-actions bot added feature dependencies Pull requests that update a dependency file python ci changes related to CI service labels Oct 15, 2025
@Xiao-zhen-Liu Xiao-zhen-Liu marked this pull request as ready for review October 16, 2025 20:33
@Xiao-zhen-Liu Xiao-zhen-Liu self-assigned this Oct 16, 2025
@Yicong-Huang
Copy link
Contributor

Yicong-Huang commented Oct 17, 2025

in your code, tests is in app. can we move it out? I also suggest you add app into a src folder`, and make test folder structure mapped to src folder structure:


  ├── src/
  │   ├──app/
  ├── test/
  │   └──app/   # contains tests regarding app
  │   └──── test_health_check.py   # Unit tests

@Yicong-Huang
Copy link
Contributor

Yicong-Huang commented Oct 17, 2025

please avoid using [[chat-assistant-service][1] this syntax.

  1. we have agreed to follow conversional commits, you can use feat(chat-assistant-service)
  2. it is generally not a good idea to label 1, 2, 3 in PRs, as this is a shared repo, your [2] != other's [2], could be confusing.

please feel free to use projects and labels to add useful information.

@Xiao-zhen-Liu Xiao-zhen-Liu changed the title feat: [chat-assistant-service][1] add backend service skeleton feat(chat-assistant-service) add backend service skeleton Oct 17, 2025
@Xiao-zhen-Liu Xiao-zhen-Liu changed the title feat(chat-assistant-service) add backend service skeleton feat(chat-assistant-service): add backend service skeleton Oct 17, 2025
@Xiao-zhen-Liu
Copy link
Contributor Author

Xiao-zhen-Liu commented Oct 20, 2025

in your code, tests is in app. can we move it out? I also suggest you add app into a src folder`, and make test folder structure mapped to src folder structure:


  ├── src/
  │   ├──app/
  ├── test/
  │   └──app/   # contains tests regarding app
  │   └──── test_health_check.py   # Unit tests

I restructured the project according to your suggestions. Note additional pytest settings needed to be added in pyproject.toml for this structure to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci changes related to CI dependencies Pull requests that update a dependency file feature python service

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants