Artifact 54d9869643e0512e9bfdb43ace99de9f4ab47f9539660aa35843e2681964fa0b:
- File
src/catalog.h
— part of check-in
[1011fc8472]
at
2026-11-19 23:29:07
on branch gemini
— A Google Gemini provider, as Pi's
The google-generative-ai API: streamGenerateContent over SSE with GEMINI_API_KEY, native parts replayed per conversation, tool calls and results, usage, and Pi's thinking mapping (thinkingLevel for Gemini 3 and later, a token budget for 2.5, 0 for off). A conversation can move between Gemini and the other providers turn by turn. Recorded streams cover text, thinking, tools, parallel calls, safety blocks, truncation and errors. (user: dmestas, size: 1437) [annotate] [blame] [check-ins using] [more...]
/* The model catalog (catalog.c): Pi's catalog of models for pic's providers, * as Pi keeps it. A snapshot is built in (model_catalog.inc); fresher * per-provider lists from https://pi.dev/api/models/providers/<id> are kept as * rows of picu_catalog in ~/.pic/pic.sqlite and used when newer than the snapshot. Entries * are Pi model objects (JSON: id, name, api, baseUrl, reasoning, * contextWindow, maxTokens, compat). */ #ifndef PIC_CATALOG_H #define PIC_CATALOG_H #include <stddef.h> /* The model object for provider/id (malloc'd JSON), or NULL. */ char *pic_catalog_find(const char *provider, const char *id); /* Calls fn for each model of the catalog, provider by provider; stops when * fn returns non-zero. 0, or -1 when the store could not be read. */ int pic_catalog_each(int (*fn)(void *ctx, const char *provider, const char *json), void *ctx); /* Refreshes the stored lists from pi.dev: each built-in provider not checked * in the last 4 hours (all of them when force), with If-None-Match. Offline * or failing providers keep what is stored. PIC_MODEL_CATALOG=offline turns * fetching off. 0 when every provider was fresh or refreshed; -1 with err * naming the first failure otherwise. */ int pic_catalog_refresh(int force, char *err, size_t errcap); /* Shared by catalog.c and catalog_fetch.c. */ #define PIC_CATALOG_NPROVIDERS 14 extern const char *const pic_catalog_providers[PIC_CATALOG_NPROVIDERS]; #endif