Skip to main content

AIConfig Tools: Configuring and Interacting AIConfigs

Overview

AIConfig Tools is a package that simplifies Prompt, Model, and Parameter Management by allowing you to create and manage AIConfigs.

Table of Contents

  1. Installation
  2. Creating AIConfig Runtime
  3. Creating and Managing Prompts
  4. Updating Model Settings
  5. Executing and Displaying Output
  6. Saving Configuration to Disk

1) Installation

First, you need to install the AIConfig Tools package and any required dependencies. Use the following command to install it. :

Python

pip install python-aiconfig

2) Creating AIConfig Runtime

To start using AIConfig Tools, create an AIConfig Runtime instance. This runtime will allow you to manage prompts, model settings, and execute AI tasks. Here's how you can create it:

from aiconfig.Config import AIConfigRuntime
aiconfig = AIConfigRuntime.create("demo", "this is a demo AIConfig")
Loading an existing config is easy too.
from aiconfig.Config import AIConfigRuntime
aiconfig = AIConfigRuntime.from_config("/path/to/config")

3) Creating and Managing Prompts

Prompts are input messages or queries you send to a Large Language model. You can create and manage prompts using AIConfig Tools. Here's an example of creating a prompt:

from aiconfig.schema import ModelMetadata, Prompt

prompt = Prompt(
    name="prompt1",
    input="Hi! What are transformers?",
    metadata={
        "model": "gpt-3.5-turbo",
    }
)

aiconfig.add_prompt(prompt.name, prompt)

4) Updating Model Settings

You can also update the settings of Large Language models, such as temperature and top-k. Here's an example of updating the model settings:

model_name = "gpt-3.5-turbo"
model_settings = {
    "top_k": 40,
    "top_p": 0.95,
    "model": "gpt-3.5-turbo",
    "temperature": 0.9
}

aiconfig.add_model(model_name, model_settings)

5) Executing and Displaying Output

Once you have created prompts and updated model settings, you can execute prompts and retrieve the output. Here's an example of executing a prompt and displaying the output:

import asyncio
parameters = {"name": "Demo"}
asyncio.run(aiconfig.run("prompt1", parameters))

latest_output = aiconfig.get_latest_output("prompt1")
output_text = aiconfig.get_output_text("prompt1", latest_output)
print(output_text)

6) Saving Configuration to Disk

You can save your AIConfig configuration to disk for later use or to share with others. This allows you to persist your prompts, model settings, and other configurations. Here's how you can save your AIConfig configuration to a file:

# Save the configuration to a file
aiconfig.save_config("my_aiconfig.json")

More Demos

Checkout the demo folder for example configs and example python notebooks.

aiconfig

aiconfig -- for prompt, model and parameter management

  • Motivation
  • Why use aiconfig
  • Getting Started
  • Core Components
  • Capabilities
    • Version Control
    • Model parser
    • Routing
    • Evaluation
  • Debugging
  • Roadmap
    • Multi-modal model support (use with image, audio generation models as well as multi-modal models like GPT-V)
    • Routing
    • Evaluation

Download files

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

Source Distribution

python-aiconfig-1.0.7.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

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

python_aiconfig-1.0.7-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file python-aiconfig-1.0.7.tar.gz.

File metadata

  • Download URL: python-aiconfig-1.0.7.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for python-aiconfig-1.0.7.tar.gz
Algorithm Hash digest
SHA256 b0a09bc95f8e696beafc1d71fd8cc23dca76d0f1fd61a9fa9234f66104379d88
MD5 99b0c7da9f14be13800897071b3bcb92
BLAKE2b-256 595fca9f8d60fa85381b0abd015404d1eae6661c8e76ab32d774ad347a06b8dd

See more details on using hashes here.

File details

Details for the file python_aiconfig-1.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for python_aiconfig-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 22cc6556f92349324af092b47c5c40433d91d3eece94bf130823f335af0bccc5
MD5 b9f0532a8f6f10cdd95aa8719510e389
BLAKE2b-256 d036672e1dffbb0f9abd4d270dafc5ed3e4f8451ff980dd29dfe5e3b7faa5a9d

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 Sentry Error logging StatusPage Status page