Skip to main content

Miksi-AI empowers your BI

Project description

Intro

Miksi AI agent works with a couple of tools to give you the final value. Mostly, it's an interchange between a tool that executes SQL queries and the one that executes the python code to generate graphs.

While the agent is instructed strictly not to execute code that writes/modifies the data, we advise you to provide a database user with only read permission to the agent.

The python code to generate graphs/charts/tables is executed within a separate virtual environment. This environment is created by default during agent initialization, at the base directory—you will see a directory called venvs. All the agent's dependencies in relation to python will be installed here—for instance, matplotlib for graphics and charts. So this will be totally independent of any other virtual environments you are running.

The generated graphs/charts by default are saved in a directory called media at the base directory. By base directory, we mean relative to where you are running the scripts that utilize our agent.

Install Miksi-AI SDK:

  • Install the latest version: pip install miksiai

The supported python versions are ['3.7', '3.8', '3.9', '3.10', '3.11','3.12']

Supported SQL based engines

The support SQL engines are MySQL, PostgreSQL, and MsSQL server

Connecting to the Database

Miksi abstracts connecting to your SQL database into "you just provide credentials" and the rest is handled.

from miksiai.sqltool import set_database_config, check_db_config_variables

 set_database_config will set the database credentials
# check_db_config_variables() will report back if any of those credentials hasn't been set or is None
set_database_config(db_name, db_user, db_password, db_host, db_port)

Keep this open when running the agent since the connection closes after every operation.

print(f"db credentials: {check_db_config_variables()}")

checking connection status

It's Important to first check if connection to your database is seamless. If you get a success connection status from the functions below then the agent will be able to connect to your engine seamlessly

Select and specify your engine from the list of supported engines belows [MySQL, PostgreSQL, MsSQL]

from miksiai.utils import check_connection
from miksiai.utils import set_db

set_db(db_name,db_user,db_password,db_host,db_port)
status = check_connection(engine= 'MySQL')

print(f"Connection status: {status}")

We now start setting up the agent by initializing the python environment.

Initialize Python Environment

from miksiai.master import initialize_env

initialize_env(env_path)

The above method will initialize an existing environment or create a new one in case none exists in the specified path. Some default standard python modules will also be installed, so this process may take some minutes when configuring/setting up for the first time.

env_path as an argument is the location you wish to create this virtual environment.

Additional Installs

Miksi AI gives you the flexibility to run additional installations for python and instruct the agent to use them. For instance, you can install matplotlib and ask the agent to use it for generating graphs/charts, or you can prefer another standard module such as plotly or seaborn. This is entirely upon you. By default, matplotlib is the default plotting library. This is also a great way to debug import not found error.

To install additional modules, run:

from miksiai.master import safe_install_modules

safe_install_modules(['modules_here'])

Creating the Agent

Miksi AI agent is context-aware, accepts custom instructions in natural language (e.g., give the answer in Slovenian), and helps maintain the states. It accepts user questions and uses the tools inside virtual environments to arrive at the final answer. Provide your own instructions in natural language (e.g., a sample on how to format the final answer or the language to give the final answer in).

from miksiai.agent import create_agent

agent = create_agent(miksi_api_key=miksi_api_key,
                     engine=engine,
                     db_name=db_name,db_user=db_user,db_password=db_password,db_host=db_host,db_port=db_port,
                     instructions=instructions)

Get your API Key:

  • Visit MiksiAPI, sign up or log in, then generate your API key. This API key will be used to use the Miksi SDK.

media_path is the directory where you wanted generated graphs/images/charts to be saved for rendering in your application.

Running the Agent

from miksiai.agent import run_agent

query = "your query here"
answer = run_agent(agent, query, media_path)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

miksiai-1.0.1-cp310-cp310-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.10Windows x86-64

miksiai-1.0.1-cp310-cp310-win32.whl (1.8 MB view details)

Uploaded CPython 3.10Windows x86

miksiai-1.0.1-cp310-cp310-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.10

miksiai-1.0.1-cp310-cp310-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

miksiai-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file miksiai-1.0.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: miksiai-1.0.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for miksiai-1.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ac6e44cf9ad8881458133b5a4aad1bde23c08d0b694054db9659955b8cedb657
MD5 12b96f0a892463cf1457a6fc1a04e9ba
BLAKE2b-256 349aabd631040eae7bc2a61b0c620d31efa39890d33c2a49e9dcbeef3d6aea24

See more details on using hashes here.

File details

Details for the file miksiai-1.0.1-cp310-cp310-win32.whl.

File metadata

  • Download URL: miksiai-1.0.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for miksiai-1.0.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 bca372cfa1e5817357f2fdb430cfa5cc2708cf002e23776734d5a226ca2989f0
MD5 cca1502fa2e07cf5aba9c99ccdc68ba3
BLAKE2b-256 bb648e61c963ca8bc947932d7567756c29535625a76746ecc5115ff9f8e8e354

See more details on using hashes here.

File details

Details for the file miksiai-1.0.1-cp310-cp310-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for miksiai-1.0.1-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9ee787850eb394d528fd0795cbb5a1cfb686fb91065591db82db83463a6e706b
MD5 a0f29a97686c83b0bb63b27079a6af75
BLAKE2b-256 f34e4c32eb99b9bd6f446867f10a84ec785909b677aa8648f376a382e80288c8

See more details on using hashes here.

File details

Details for the file miksiai-1.0.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for miksiai-1.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 313462e8c958bfa9dc09854e2e9ad682f0282dc8575e1dc929388f76c8489e3b
MD5 3038cf9742fd5cb7ed521d8a086d8e9a
BLAKE2b-256 6fdbec4858868cddd179dd33f3cb400d5878bc091891fdb063824fa3e7f469d2

See more details on using hashes here.

File details

Details for the file miksiai-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for miksiai-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1e67624ad540ff3e9f8a3678ac7b6578e866b7e2d9774e6e7c0c9e405e60ad53
MD5 dced6e6392537617b5e8132d63ded9bc
BLAKE2b-256 e473d441627138da54967463f0ad2315f57784ee07ebf22374f17d343446ff06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page