Skip to content

This pull request introduces significant improvements to the LLM API, including database integration for storing and retrieving LLM completions, new SQL and utility scripts, and updated tests.#58

Merged
goldlabelapps merged 2 commits intomasterfrom
staging
Apr 4, 2026

Conversation

@goldlabelapps
Copy link
Copy Markdown
Owner

The /llm endpoint now supports paginated retrieval of completions from the database, and the POST endpoint records each completion along with metadata. Additionally, a new table schema and a data seeding script are added, and tests are updated to reflect the new API.

API and Database Integration:

  • The /llm GET endpoint now returns a paginated list of LLM completions from the database, including metadata such as total records and pages.
  • The /llm POST endpoint now records each prompt, completion, duration, and related metadata in the new llm database table after a successful LLM call. [1] [2] [3]

Database Schema and Utility Scripts:

  • Added app/api/llm/sql/create_table.sql to define the llm table schema, including fields for vector, prompt, completion, duration, time, data, and model.
  • Added app/api/llm/sql/insert_llm_lorem.py script to insert sample records into the llm table for testing or development purposes.

Testing and Versioning:

  • Refactored and renamed tests from test_gemini.py to test_llm.py, updating them to target the new /llm endpoints and revised API responses. [1] [2] [3] [4]
  • Updated the application version to 2.1.2 in app/__init__.py.

Create a new llm table SQL schema (vector(1536), prompt, completion, duration, time, data). Add a small psycopg2 seed script (insert_llm_lorem.py) that loads .env, connects to the DB and inserts 5 dummy records with random 1536-d vectors. Rename tests/test_gemini.py to tests/test_llm.py and update tests to use LLM naming and /llm endpoints, adjust skip/failure messages and assertions accordingly (including updated mocked API handling). These changes introduce the DB schema and local seeding helper and align tests to the LLM endpoint/name changes.
Add a paginated GET /llm endpoint that queries the llm table and returns page metadata. Enhance POST /llm to time Gemini calls, persist completions (prompt, completion, duration, data, model) to the database (errors logged but not exposed), and use a direct DB connection helper. Update SQL to add a model column to the llm table, bump package version to 2.1.2, and adjust tests to match the new meta title content.
@goldlabelapps goldlabelapps self-assigned this Apr 4, 2026
@goldlabelapps goldlabelapps merged commit f13d864 into master Apr 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant