Python client library for Blin API (natural language to API service)
Project description
Blin
Blin helps to build a lucid interface between users and your system. It empowers the system with intelligence to recognize user intentions, provide information or control functionality via commands!
Key Features
-
Prompt to commands: understands user intentions from a text prompt and returns the best fitting commands
-
Multi-request: returns multiple commands if user's intention is to perform several tasks simultaneously (e.g., increase temperature and decrease volume)
-
Valid command guarantee: always returns a valid command with valid parameters
-
Additional knowledge: ability to add texts that are used to provide additional context or guidance for the user
-
Infinite memory (almost): as long as there's space in cloud, there's room for learning
Usage is simple
my_ai = blin.open_project('MyAI', key=blin_key)
response = my_ai.request("I'm hot")
>>> response
{
'commands': {'decrease_temperature': {'parameters': {'delta': 5}}},
'text': "I've decreased the temperature by 5 degrees Fahrenheit."
}
response = my_ai.request("My ears are bleeding from this music")
>>> response
{
'commands': {'audio_adjust_volume': {'parameters': {'delta': -10}}},
'text': "I'm sorry to hear that. I've adjusted the volume for you."
}
Getting started
Install blin:
pip install blin
Create your AI:
blin_key = "<blin_key>" # contact us: support@lemeni.com to get one
settings = {"openai_key" : "<openai_key>", # get your key @ https://openai.com/
"pinecone_key" : "<pinecone_key>", # get your key @ https://www.pinecone.io/
"pinecone_index": "<pinecone_index>" } # create your index @ https://www.pinecone.io/
blin.create_project('MyAI', settings=settings, key=blin_key)
Define commands to control the system:
commands = {
"increase_temperature": {
"brief" : "Increases temperature per user's request or when it's too low",
"parameters": {
"delta": "integer value from interval [1, 10] that represents temperature increase in Fahrenheit"
}
},
"decrease_temperature": {
"brief" : "Decreases temperature per user's request or when it's too high",
"parameters": {
"delta": "integer value from interval [1, 10] that represents temperature decrease in Fahrenheit"
}
},
"adjust_volume": {
"brief" : "Makes volume adjustment",
"parameters": {
"delta": "integer value from interval [-10, 10] that represents volume adjustment in %"
}
},
}
Train your AI:
my_ai = blin.open_project('MyAI', blin_key)
my_ai.learn_commands(commands)
Use it:
my_ai = blin.open_project('MyAI', blin_key)
command = my_ai.request("I'm hot")
call(command) # your function to execute commands
API Documentation
Create project
Create project. All learned commands/texts will be stored in it
blin.create_project(project_id, settings, key)
- project_id (str) : name of the project
- settings (dict) : project settings dict in the format: { "openai_key" : "...", "pinecone_key" : "...", "pinecone_index": "...", }
- key (str) : blin authorization key
- returns: str: result. Raises exception if the project was already created.
Open project
Open created project for learning or usage
project = blin.open_project(project_id, key)
- project_id (str) : project identifier
- key (str) : blin authorization key
- returns: Project object
Delete Project
Remove project. Warning: all knowledge (commands and texts) associated will be removed, and cannot be restored!
blin.delete_project(project_id, key)
- project_id (str) : project identifier
- key (str) : blin authorization key
- returns: str: result. Raises exception if the project was not deleted.
Learn Commands
Add commands to the project
project.learn_commands(commands)
- commands (dict) : commands dict to learn, in the format below
- returns: None
# Commands dict format
commands = {
"command_name_1" : {
"brief" : "string description of command purpose",
"parameters": {
"parameter_name": "string description of parameter purpose, type, range",
...
},
"command_name_2" : ...
}
Learn Texts
Add texts to the project. This information is used by AI as additional context or to provide guidance for the user
project.learn_texts(texts):
- texts (dict) : texts to learn in the format: { "text_name" : "text", ... }
- returns: None
Recall Command Names
Return a list of names of all learned commands
project.recall_command_names()
- returns: list: names of all learned commands
Recall Text Names
Return a list of names of all learned texts
project.recall_text_names()
- returns: list: names of all learned texts
Recall Command or Text
Return learned command or text for given name
project.recall(name)
- name (str) : command or text name
- returns: dict: learned command or text (see Learn Commands , Learn Texts)
Forget Command or Text
Delete the knowledge (command of text)
project.forget(name)
- name (str) : command or text name
- returns: str: result. Raises exception if the knowledge was not deleted.
Request AI Answer
Return command to execute or/and text response based on user request and project knowledge
project.request(request)
- request (str) : user request
- returns: dict: commands to execute (can be {}) and text response (can be "") in the format below
{
"commands" : <commands_dict>,
"text" : "text response"
}
Contacts
For any questions or feedback, you can reach us at support@lemeni.com.
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 blin-0.2.1.tar.gz.
File metadata
- Download URL: blin-0.2.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ed44bd354a66371fa7cbd26c6bd4674a876117c1e8f73f6b66118934dce3978
|
|
| MD5 |
d1d171dca7d280397b3448e5a44b6aba
|
|
| BLAKE2b-256 |
353cf75d5fdf3ae8e78bcb1ac9bc3da2fcfd0c24ad2c905b04d0288192628882
|
File details
Details for the file blin-0.2.1-py3-none-any.whl.
File metadata
- Download URL: blin-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f20fbe2b4f68945cb03a46b8866b6cfeb29ce8b962d0165456b7b278a4995d9
|
|
| MD5 |
de691d52c45967ae30cd1785a5bd9f5d
|
|
| BLAKE2b-256 |
82f9c5390966b426d8733c70f3c64ac645c96d613e33e61688bf79f34cb839a4
|