No project description provided
Project description
MockAI
MockAI is a library that allows you to mock AI responses using custom commands suitable for simulating responses during testing without AI inference cost.
Installation
To install MockAI, use pip:
pip install mockai
Usage
To use MockAI, create a configuration file with your command and the respective full response path.
Example configuration file:
{
"/default": "full/path/to/mock_responses/default.json",
"/mycommand": "full/path/to/mock_responses/mock_responses/my_command.json"
}
To override the default format for all non-command inputs overwrite it by:
{
"_default": "full/path/to/_default.json"
}
If it's not overwritten it returns the OpenAI JSON response structure.
After creating the configuration files import the mock_completion and set_config from mockai to :
from mockai import mock_completion, set_config
set_config('config.json')
response = mock_completion(model='your-model', messages=[{"role":"user", "content":"/mycommand"}])
print(response) # output: "Retrieving the output defined in the mock_responses/my_command.json"
Limitations
MockAI does not support streaming at the moment.
License
MockAI is licensed under the MIT License.
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 mockai-0.0.3.tar.gz.
File metadata
- Download URL: mockai-0.0.3.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e05f12253aa92dde83888153d9383874eb45f93ede83452607465b297486b147
|
|
| MD5 |
2b094484bcc47fb27ffa1da27fbc7759
|
|
| BLAKE2b-256 |
61ffd1afcd0b54f253bd94a7852f2d8c3453af730d8ba0ebd9d3ca7a2dce1f73
|
File details
Details for the file mockai-0.0.3-py3-none-any.whl.
File metadata
- Download URL: mockai-0.0.3-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e296de4d3a405cc823c094b82dc982f62b7b44edc027c7d447b9f74b2252239
|
|
| MD5 |
07d65b1d506151d979b8c230474ffa78
|
|
| BLAKE2b-256 |
f7c08a22a62a428a79d240d27626726eda525b82b9984149825989ef6815a737
|