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 miksi_ai_sdk

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 miksi_ai_sdk.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 miksi_ai_sdk.utils import check_connection
from miksi_ai_sdk.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 miksi_ai_sdk.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 miksi_ai_sdk.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 Slovakian), 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 miksi_ai_sdk.agent import create_agent

agent = create_agent(miksi_api_key=miksi_api_key, media_path=media_path, 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 miksi_ai_sdk.agent import run_agent

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

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

miksi_ai_sdk-0.0.21-pp39-pypy39_pp73-win_amd64.whl (175.2 kB view hashes)

Uploaded PyPy Windows x86-64

miksi_ai_sdk-0.0.21-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (203.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

miksi_ai_sdk-0.0.21-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (211.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

miksi_ai_sdk-0.0.21-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (173.4 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

miksi_ai_sdk-0.0.21-pp38-pypy38_pp73-win_amd64.whl (172.2 kB view hashes)

Uploaded PyPy Windows x86-64

miksi_ai_sdk-0.0.21-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (203.0 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

miksi_ai_sdk-0.0.21-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (212.2 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

miksi_ai_sdk-0.0.21-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (171.5 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

miksi_ai_sdk-0.0.21-pp37-pypy37_pp73-win_amd64.whl (172.2 kB view hashes)

Uploaded PyPy Windows x86-64

miksi_ai_sdk-0.0.21-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (203.0 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

miksi_ai_sdk-0.0.21-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (212.2 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

miksi_ai_sdk-0.0.21-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (171.3 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

miksi_ai_sdk-0.0.21-cp311-cp311-win_amd64.whl (216.7 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

miksi_ai_sdk-0.0.21-cp311-cp311-win32.whl (188.7 kB view hashes)

Uploaded CPython 3.11 Windows x86

miksi_ai_sdk-0.0.21-cp311-cp311-musllinux_1_1_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

miksi_ai_sdk-0.0.21-cp311-cp311-musllinux_1_1_i686.whl (1.4 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

miksi_ai_sdk-0.0.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

miksi_ai_sdk-0.0.21-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.4 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

miksi_ai_sdk-0.0.21-cp311-cp311-macosx_10_9_x86_64.whl (240.9 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

miksi_ai_sdk-0.0.21-cp310-cp310-win_amd64.whl (214.5 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

miksi_ai_sdk-0.0.21-cp310-cp310-win32.whl (189.6 kB view hashes)

Uploaded CPython 3.10 Windows x86

miksi_ai_sdk-0.0.21-cp310-cp310-musllinux_1_1_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

miksi_ai_sdk-0.0.21-cp310-cp310-musllinux_1_1_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

miksi_ai_sdk-0.0.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

miksi_ai_sdk-0.0.21-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.2 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

miksi_ai_sdk-0.0.21-cp310-cp310-macosx_10_9_x86_64.whl (239.9 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

miksi_ai_sdk-0.0.21-cp39-cp39-win_amd64.whl (215.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

miksi_ai_sdk-0.0.21-cp39-cp39-win32.whl (190.3 kB view hashes)

Uploaded CPython 3.9 Windows x86

miksi_ai_sdk-0.0.21-cp39-cp39-musllinux_1_1_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

miksi_ai_sdk-0.0.21-cp39-cp39-musllinux_1_1_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

miksi_ai_sdk-0.0.21-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

miksi_ai_sdk-0.0.21-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

miksi_ai_sdk-0.0.21-cp39-cp39-macosx_10_9_x86_64.whl (240.5 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

miksi_ai_sdk-0.0.21-cp38-cp38-win_amd64.whl (216.0 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

miksi_ai_sdk-0.0.21-cp38-cp38-win32.whl (190.3 kB view hashes)

Uploaded CPython 3.8 Windows x86

miksi_ai_sdk-0.0.21-cp38-cp38-musllinux_1_1_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

miksi_ai_sdk-0.0.21-cp38-cp38-musllinux_1_1_i686.whl (1.4 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

miksi_ai_sdk-0.0.21-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

miksi_ai_sdk-0.0.21-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

miksi_ai_sdk-0.0.21-cp38-cp38-macosx_10_9_x86_64.whl (237.4 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

miksi_ai_sdk-0.0.21-cp37-cp37m-win_amd64.whl (211.7 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

miksi_ai_sdk-0.0.21-cp37-cp37m-win32.whl (187.3 kB view hashes)

Uploaded CPython 3.7m Windows x86

miksi_ai_sdk-0.0.21-cp37-cp37m-musllinux_1_1_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

miksi_ai_sdk-0.0.21-cp37-cp37m-musllinux_1_1_i686.whl (1.1 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ i686

miksi_ai_sdk-0.0.21-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

miksi_ai_sdk-0.0.21-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

miksi_ai_sdk-0.0.21-cp37-cp37m-macosx_10_9_x86_64.whl (234.0 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

miksi_ai_sdk-0.0.21-cp36-cp36m-win_amd64.whl (227.9 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

miksi_ai_sdk-0.0.21-cp36-cp36m-win32.whl (194.4 kB view hashes)

Uploaded CPython 3.6m Windows x86

miksi_ai_sdk-0.0.21-cp36-cp36m-musllinux_1_1_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ x86-64

miksi_ai_sdk-0.0.21-cp36-cp36m-musllinux_1_1_i686.whl (1.0 MB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ i686

miksi_ai_sdk-0.0.21-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

miksi_ai_sdk-0.0.21-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (992.8 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

miksi_ai_sdk-0.0.21-cp36-cp36m-macosx_10_9_x86_64.whl (220.2 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

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