Skip to main content

frirapi (Frire AI API)

License: GPL v3 Python Version

frirapi (also known as Pancakapi) is a lightweight, trilingual (English, French, Spanish) Python module designed to query, train, and manage a synchronized cloud-based knowledge database powered by Supabase. It also includes built-in fallback web-scraping via DuckDuckGo Search when local data isn't enough.

Originally built for the Frire AI ecosystem, this package allows any Python developer to integrate the AI's core brain directly into their own applications, bots, scripts, or web backends.


Features

  • Cloud Sync: Instantly fetches and synchronizes structured Q&A data from a Supabase central brain.
  • Smart Matching: Uses tokenization, string cleaning, and SequenceMatcher string similarity algorithms to find the best local answer.
  • Autonomous Learning: Real-time feedback loop that dynamically adjusts the confidence/reliability scores of answers in the cloud database.
  • Web Fallback: Automatically scrapes trusted web sources (Wikipedia, Larousse, Britannica, etc.) if local knowledge confidence is low.
  • Trilingual Translation: Automatically handles incoming queries and returns localized answers in English, French, or Spanish using deep-translator.
  • Adaptive Response Styles: Choose between courte (short), normale (normal), or detaillee (detailed) outputs.
  • Hot-Reload Auto-Updater: Update the package to the latest version at runtime without restarting your script.

Installation

Install the package and its requirements using your favorite package manager:

pip install frirapi 
uv pip install firapi
poetry add frirapi@latest

and more package manager...


Quick Start Guide

Here is how you can fetch the database and start chatting with the AI core:

import frirapi

# 1. Initialize and load the central brain from the Cloud
print("Loading database...")
brain_database = frirapi.charger_base()

# 2. Define a question and preferred settings
user_question = "What is an Hantavirus?"
response_style = "normale"  # Options: "short", "normal", "detailed"
language = "en"             # Options: "en", "fr", "es"

# 3. Query the AI
response, confidence, exact_match = frirapi.ia_repond(
    question=user_question, 
    BASE_DE_DONNEES=brain_database, 
    style_actuel=response_style, 
    langue_ia=language
)

# 4. Format and print the final result
if response:
    final_output = frirapi.varier_reponse(response, response_style, user_question)
    print(f"AI Response: {final_output}")
    print(f"Confidence Score: {confidence}%")
    print(f"Source/Match: {exact_match}")
else:
    print("The AI does not know the answer.")

Database Interaction & Learning Loop

1. Training the AI (Confidence adjustment)

If the AI answered a question using an existing database entry (exact_match), you can supply a feedback loop to let it learn and save the new weight directly to Supabase:

# Assuming the user validated the response:
is_correct = True  # Set to False if the answer was wrong

if exact_match and not exact_match.startswith("[WEB]"):
    frirapi.ia_apprend(exact_match, is_correct, brain_database)

2. Manually adding knowledge to the Cloud

You can contribute directly to the global brain by pushing a new question, answer, and category ("sciences", "maths", or "culture"):

frirapi.ajouter_a_supabase(
    question="What is 2+2?", 
    reponse="4", 
    categorie="maths"
)

Hot-Reload Auto-Updater (State)

frirapi comes with an built-in runtime module updater. If you want to make sure your scripts are always using the latest release without manual re-deployments or application restarts, you can call the State.UpdateModule method:

import frirapi

# Update package at runtime using your preferred package environment
# Supported modes: "pip", "uv", "poetry", "conda", "git"
frirapi = frirapi.State.UpdateModule(mode="uv")
# The module is now updated and reloaded into memory!

License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the LICENSE file for more details.

Contact & Support

Creator: ZedKa450

Discord: zedka450

E-mail: zedka.le.vrai.pro@gmail.com

GitHub Repository: https://github.com/zedka450/Frire-AI

Metadata

Release files for frirapi 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for frirapi 1.0.0
File Size Uploaded Provenance Actions
frirapi-1.0.0.tar.gz 18.8 kB Without provenance Details for frirapi-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for frirapi 1.0.0
File Interpreter ABI Platform Actions
frirapi-1.0.0-py3-none-any.whl Python 3 none any Details for frirapi-1.0.0-py3-none-any.whl

Total release size: 38.2 kB

Release files / frirapi-1.0.0.tar.gz

Download URL frirapi-1.0.0.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c01d10cb520beb8e22d93630ec6936e7fc115d014f6d5b84e6d2098599723972
BLAKE2b-256 checksum
How to use checksums
a6e437c51230b7cabb1ee5cfb55d1cc1588f70f55b3788e16ebaf9f32eefdea5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / frirapi-1.0.0-py3-none-any.whl

Download URL frirapi-1.0.0-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07991970040a8d89a39c2c7ff0d1a249a348ab2a55ce30510410f47bb94c601a
BLAKE2b-256 checksum
How to use checksums
705d49133409f9f45904c091a6f8989f69ff2286e7613eae91f926b0975efd68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for frirapi 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page