Trilingual AI API module (English, French, Spanish) synchronized with a Supabase cloud brain and equipped with web fallback search capabilities.
Project description
frirapi (Frire AI API)
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
SequenceMatcherstring 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), ordetaillee(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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file frirapi-1.0.0.tar.gz.
File metadata
- Download URL: frirapi-1.0.0.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c01d10cb520beb8e22d93630ec6936e7fc115d014f6d5b84e6d2098599723972
|
|
| MD5 |
847ab7fbe5c6dcc88c849d4b5ddec28a
|
|
| BLAKE2b-256 |
a6e437c51230b7cabb1ee5cfb55d1cc1588f70f55b3788e16ebaf9f32eefdea5
|
File details
Details for the file frirapi-1.0.0-py3-none-any.whl.
File metadata
- Download URL: frirapi-1.0.0-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07991970040a8d89a39c2c7ff0d1a249a348ab2a55ce30510410f47bb94c601a
|
|
| MD5 |
a303cb67e238515371ead755ceb8d1e6
|
|
| BLAKE2b-256 |
705d49133409f9f45904c091a6f8989f69ff2286e7613eae91f926b0975efd68
|