Python backend development

Python for AI, document processing and data-heavy servers: we wrote Logaritim’s question-generation pipeline with FastAPI.

We build Python back ends with FastAPI for AI and document-heavy work. Logaritim runs its pipeline from PDF to an approved question pool on Python.

Last updated:

What we have built with it

All of them are live; store pages and details are on the Products page.

Logaritim

Question pool and exam builder

FastAPI and Pydantic; course PDFs are parsed with PyMuPDF, questions are generated and checked with Gemini, and exam papers are built as PDFs on the server.

See the product

Where Python is the right choice

Python’s real strength is the libraries around it. PDF reading, image processing, tables and numerical work, chart drawing and the official SDKs of AI models are mature and well documented in Python. When a server’s job is not just keeping records but understanding documents, transforming data or talking to a model, we choose Python. With FastAPI, the same code also goes live as a tidy API that other systems connect to.

Where Python fits well

  • You need structured data out of documents such as PDFs, images or spreadsheets
  • An AI model sits at the centre of the product and its output has to be checked
  • You want outputs such as charts, figures or reports generated from code
  • Data cleaning, matching and transformation make up most of the work

Where we would suggest another language

  • The app is mostly records, forms and permissions; Node.js, which speaks the same language as web and mobile, is more practical here
  • Instant messaging and live connections are at the centre of the product
  • The server code will share types with a mobile app

Logaritim: from PDF to an approved question pool

Logaritim generates questions from course material, checks them, collects them in an approved pool and lets institutions build exams from that pool. The whole pipeline is written in Python:

01
Course PDF
02
Parsing with PyMuPDF
03
Question generation with Gemini
04
Rule checks and independent solving
05
Approved pool
06
Exam PDF and API
Before a question enters the pool it passes both the rules and a solution by a second model.
  • PDFs are cropped question by question with PyMuPDF, following the page layout, then analysed with Gemini and turned into structured data.
  • When questions are generated for a topic, the relevant course content is found by semantic search over vectors stored in PostgreSQL with pgvector; without vectors it falls back to keyword ranking.
  • A generated question first goes through rule-based checks; malformed questions are dropped without spending a model call.
  • Then a second model call solves the question without seeing the answer key, and a judge step compares the two answers.
  • Figures for visual questions are drawn from code: function graphs and analytic geometry with matplotlib, history maps with Shapely.
  • The exam paper and answer key are built as PDFs on the server with PyMuPDF, with the Turkish font and images embedded in the file.

Opening up to other systems with FastAPI

Institutions connect to Logaritim’s question pool over an API. Long generation jobs run in the background, and when a job finishes the result is sent to the other system through a webhook signed with HMAC. API keys are shown only at the moment they are created; the database keeps only their hashes.

TaskLibraryWhere it sits in Logaritim
API and input validationFastAPI, PydanticThe endpoints institutions connect to, and the admin panel
Running on the serverGunicorn, Uvicorn, DockerThe API process, running with several workers
Reading and writing PDFsPyMuPDFParsing course material, exam paper and answer key
AIgoogle-genai (Gemini, Vertex AI)Question generation, independent solving and judging
Semantic searchPostgreSQL, pgvectorFinding the course content that fits a topic
Drawingmatplotlib, ShapelyGraphs, geometric figures, maps
Rate limitingslowapiLimiting the requests that reach the API

How a Python project runs

  1. 01

    Free scoping call

    30 min

    We talk about which documents or data the system will work with, who the output is for and the budget you have in mind.

  2. 02

    Written scope and quote

    We write down the input formats, the expected output, the quality-control rules and the AI model to be used.

  3. 03

    Weekly releases

    Every week we deliver a working build; you run the pipeline on your own sample documents and see the results.

  4. 04

    Testing and release

    A senior QA tests the build before release; then the service goes live.

  5. 05

    The 30 days after launch

    30 days

    We fix the bugs that surface in this period free of charge; after that you can continue with monthly maintenance.

Timelines and budget ranges are published on our AI automation and pricing pages; everything on this page follows the same figures.

Questions about Python

Isn’t Python slow for a server?

In systems like these most of the time goes to the model, the database and file work; the language itself is not the bottleneck. FastAPI is asynchronous, Gunicorn starts several Uvicorn workers, and numerical work runs in libraries written in C, such as NumPy.

How is AI-generated content checked?

Logaritim has three layers: rule-based checks first remove formatting errors, then a second model solves the question without seeing the answer, and finally a judge step compares the two results. Only approved questions enter the pool.

Which AI models do you work with?

In Logaritim we use Google Gemini through both the Gemini API and Vertex AI, and every call is logged with its token usage. On the Rigel and LydiaVault servers we use OpenAI. We choose the model to fit the project.

How does a Python service connect to our existing system?

Through a documented REST API, an API key and a signed webhook that arrives when a job is done. That is how institutions connect to Logaritim’s question pool.

What do I keep when the project ends?

A perpetual licence to use the software, and its documentation. Handing over the source code is possible if you want it; the extra fee is written separately in the quote.

Related services

AI automationAI agentsCustom softwareDashboards
Contact

Let’s talk about your Python project

In a free 30-minute scoping call we work through your documents, the output you expect and where AI will actually help.