SShortSingh.
Back to feed

Python script queries local Ollama model using only the standard library

0
·1 views

A developer describes calling a locally running Ollama model from Python using only the standard library, with no SDK or external packages. The approach posts a request to Ollama's HTTP endpoint on port 11434 and reads the generated text from the response. The author used this method in a small tool, about 306 lines long, that explains Swiss administrative letters in plain Italian. In testing, a 1B-parameter Gemma model took roughly 40 seconds on a CPU to explain a payment order, a trade-off accepted for privacy since no data leaves the machine. The author notes that for needs like retries, pooling or async calls, a dedicated client library may still be worthwhile.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Open Diagnostics: A Hacktoberfest Open-Source AI Challenge Submission

A DEV Community post presents a submission to the Hacktoberfest Open-Source AI Challenge, Week 2, themed "Side Hustle." The author links to a GitHub repository hosting the project. The post itself offers little beyond the submission notice and the repository reference. No details about the project's features, functionality, or outcomes are included in the text provided.

0
ProgrammingDEV Community ·

Scaling Node.js and PostgreSQL APIs: Pooling, Validation, Indexing and Queues

Backend slowdowns under heavy traffic often stem from inefficient database queries, missing connection pooling, and weak async handling rather than hardware limits. The article recommends using a managed connection pool through pg or Prisma instead of opening a new client per request. It also advises validating incoming data at the API edge with Zod or class-validator before it reaches the database. Indexing with B-tree or GIN structures is highlighted as a way to speed up slow queries on large PostgreSQL tables. Finally, offloading heavy tasks such as webhooks and third-party calls to background queue workers is presented as key to predictable performance.

0
ProgrammingDEV Community ·

Firefox Print and Save-to-PDF Features Many Users Overlook

Firefox's recent print interface, introduced around version 87, includes a live preview sidebar that updates as settings change. Users can save pages directly to PDF without an external printer, with clickable links and searchable text preserved. Reader View can produce cleaner printouts of article pages by stripping navigation, ads, and sidebars. Additional options cover page layout, headers and footers, paper sizes, and selection-only printing. Developers can also test print stylesheets through DevTools by emulating print media.

0
ProgrammingDEV Community ·

Amir Ali's MatchReady and Smart Doc Show Two Hard Frontend Problems Solved

Developer Amir Ali, a full-stack engineer in Karachi, Pakistan, has released two open-source side projects that tackle deceptively difficult frontend challenges. MatchReady is a browser-based 2D soccer drill builder that animates player movement and exports drills as GIFs, with no backend or account required. Its playback logic is designed as a pure function of time, so the live preview and the exported GIF match frame for frame. The project also samples curved paths and reparameterises them by arc length so that movement speed stays consistent along curves. Smart Doc is a small collaborative editor supporting shared documents, role-based permissions, comments, version history and Markdown or PDF export. Both projects are open source and include live demos for anyone who wants to examine the code.

Python script queries local Ollama model using only the standard library · ShortSingh