[![Python](https://img.shields.io/badge/Python-3%2E11-blue?logo=python)](https://devguide.python.org/versions/)
[![OpenAI](https://img.shields.io/badge/OpenAI-GPT--4o-green?logo=openai)](https://platform.openai.com/docs/models/gpt-4o)
[![experimental](https://img.shields.io/badge/stability-experimental-red)](http://github.com/badges/stability-badges)
[![interface](https://img.shields.io/badge/Interface-CLI-darkblue?logo=windowsterminal)](https://github.com/CentreonLabs/txt2cql/blob/assets/assets/output.gif?raw=true)
# txt2cql
`txt2cql` is a command-line tool designed to convert input text into a valid [_Centreon Query Language_ (CQL)](https://docs.centreon.com/docs/alerts-notifications/resources-status/#cql-criteria) request. The generated CQL is automatically copied to your clipboard, ready to be pasted into the research bar of the resource status page in Centreon.
![Demo Animation](https://github.com/CentreonLabs/txt2cql/blob/assets/assets/output.gif?raw=true)
## Installation
### <summary> Installing pipx </summary>
<details>
From their [documentation](https://pipx.pypa.io/stable/installation/):
#### On macOS:
```bash
brew install pipx
pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions in global scope. See "Global installation" section below.
```
#### On Linux:
##### Ubuntu 23.04 or above
```bash
sudo apt update
sudo apt install pipx
pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions in global scope. See "Global installation" section below.
```
##### Fedora:
```bash
sudo dnf install pipx
pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions in global scope. See "Global installation" section below.
Using pip on other distributions:
python3 -m pip install --user pipx
python3 -m pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions in global scope. See "Global installation" section below.
```
#### On Windows:
##### Install via Scoop:
```bash
scoop install pipx
pipx ensurepath
```
#### Install via pip (requires pip 19.0 or later)
```bash
# If you installed python using Microsoft Store, replace `py` with `python3` in the next line.
py -m pip install --user pipx
py -m pipx ensurepath
```
It is possible (even most likely) the above finishes with a WARNING looking similar to this:
```bash
WARNING: The script pipx.exe is installed in `<USER folder>\AppData\Roaming\Python\Python3x\Scripts` which is not on PATH
```
If so, go to the mentioned folder, allowing you to run the pipx executable directly. Enter the following line (even if you did not get the warning):
```bash
.\pipx.exe ensurepath
```
This will add both the above mentioned path and the %USERPROFILE%\.local\bin folder to your search path. Restart your terminal session and verify pipx does run.
</details>
### Installing txt2cql
```bash
pipx install git+https://github.com/CentreonLabs/txt2cql
```
### Export OpenAI API key
For the tool to work, you need to export your OpenAI API key as an environment variable. You can do this by adding the following line to your shell configuration file (e.g., `~/.bashrc`, `~/.zshrc`, etc.):
```bash
export OPENAI_API_KEY="your-api-key"
```
## Usage
```bash
txt2cql all ping services for all linux hosts
> s.description:ping h.name:linux
```
Raw data
{
"_id": null,
"home_page": "https://github.com/CentreonLabs/txt2cql",
"name": "txt2cql",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": "centreon, LLM",
"author": "Denis Roussel",
"author_email": "droussel@centreon.com",
"download_url": "https://files.pythonhosted.org/packages/8b/24/321ab83a709f52db73dcc89dd9c1a6574a7c058115e940a46547d41ed6ad/txt2cql-0.1.0.tar.gz",
"platform": null,
"description": "[![Python](https://img.shields.io/badge/Python-3%2E11-blue?logo=python)](https://devguide.python.org/versions/) \n[![OpenAI](https://img.shields.io/badge/OpenAI-GPT--4o-green?logo=openai)](https://platform.openai.com/docs/models/gpt-4o) \n[![experimental](https://img.shields.io/badge/stability-experimental-red)](http://github.com/badges/stability-badges) \n[![interface](https://img.shields.io/badge/Interface-CLI-darkblue?logo=windowsterminal)](https://github.com/CentreonLabs/txt2cql/blob/assets/assets/output.gif?raw=true)\n\n# txt2cql\n\n`txt2cql` is a command-line tool designed to convert input text into a valid [_Centreon Query Language_ (CQL)](https://docs.centreon.com/docs/alerts-notifications/resources-status/#cql-criteria) request. The generated CQL is automatically copied to your clipboard, ready to be pasted into the research bar of the resource status page in Centreon.\n\n![Demo Animation](https://github.com/CentreonLabs/txt2cql/blob/assets/assets/output.gif?raw=true)\n\n## Installation\n\n### <summary> Installing pipx </summary>\n\n<details>\n\nFrom their [documentation](https://pipx.pypa.io/stable/installation/):\n\n#### On macOS:\n\n```bash\nbrew install pipx\npipx ensurepath\nsudo pipx ensurepath --global # optional to allow pipx actions in global scope. See \"Global installation\" section below.\n```\n\n#### On Linux:\n\n##### Ubuntu 23.04 or above\n\n```bash\nsudo apt update\nsudo apt install pipx\npipx ensurepath\nsudo pipx ensurepath --global # optional to allow pipx actions in global scope. See \"Global installation\" section below.\n```\n\n##### Fedora:\n\n```bash\nsudo dnf install pipx\npipx ensurepath\nsudo pipx ensurepath --global # optional to allow pipx actions in global scope. See \"Global installation\" section below.\nUsing pip on other distributions:\npython3 -m pip install --user pipx\npython3 -m pipx ensurepath\nsudo pipx ensurepath --global # optional to allow pipx actions in global scope. See \"Global installation\" section below.\n```\n\n#### On Windows:\n\n##### Install via Scoop:\n\n```bash\nscoop install pipx\npipx ensurepath\n```\n\n#### Install via pip (requires pip 19.0 or later)\n\n```bash\n# If you installed python using Microsoft Store, replace `py` with `python3` in the next line.\npy -m pip install --user pipx\npy -m pipx ensurepath\n```\nIt is possible (even most likely) the above finishes with a WARNING looking similar to this:\n\n```bash\nWARNING: The script pipx.exe is installed in `<USER folder>\\AppData\\Roaming\\Python\\Python3x\\Scripts` which is not on PATH\n```\n\nIf so, go to the mentioned folder, allowing you to run the pipx executable directly. Enter the following line (even if you did not get the warning):\n\n```bash\n.\\pipx.exe ensurepath\n```\n\nThis will add both the above mentioned path and the %USERPROFILE%\\.local\\bin folder to your search path. Restart your terminal session and verify pipx does run.\n\n</details>\n\n### Installing txt2cql\n\n```bash\npipx install git+https://github.com/CentreonLabs/txt2cql\n```\n\n### Export OpenAI API key\n\nFor the tool to work, you need to export your OpenAI API key as an environment variable. You can do this by adding the following line to your shell configuration file (e.g., `~/.bashrc`, `~/.zshrc`, etc.):\n\n```bash\nexport OPENAI_API_KEY=\"your-api-key\"\n```\n\n## Usage\n\n```bash\ntxt2cql all ping services for all linux hosts\n\n> s.description:ping h.name:linux\n```\n",
"bugtrack_url": null,
"license": "AGPL-3.0-or-later",
"summary": "Convert input text into a valid Centreon Query Language request",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/CentreonLabs/txt2cql",
"Repository": "https://github.com/CentreonLabs/txt2cql"
},
"split_keywords": [
"centreon",
" llm"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c72a02b6e1cc35156bec65c1638f62a7781ffd8f21712b78dda96d450209d7cb",
"md5": "1878aa3a8697e9b16cb10b304c49d78d",
"sha256": "8843fae8ca7bb0dfc388d70915075759d916804f850714d0360f87a999ee88bd"
},
"downloads": -1,
"filename": "txt2cql-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1878aa3a8697e9b16cb10b304c49d78d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 15920,
"upload_time": "2024-06-03T18:54:17",
"upload_time_iso_8601": "2024-06-03T18:54:17.763116Z",
"url": "https://files.pythonhosted.org/packages/c7/2a/02b6e1cc35156bec65c1638f62a7781ffd8f21712b78dda96d450209d7cb/txt2cql-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8b24321ab83a709f52db73dcc89dd9c1a6574a7c058115e940a46547d41ed6ad",
"md5": "2e212cb985caf9c5b6e879be2147489b",
"sha256": "a5c13275bc9d5b0254eff0ac820425d59947b50945032f0d12f7a4f6147a645c"
},
"downloads": -1,
"filename": "txt2cql-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "2e212cb985caf9c5b6e879be2147489b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 14862,
"upload_time": "2024-06-03T18:54:19",
"upload_time_iso_8601": "2024-06-03T18:54:19.504527Z",
"url": "https://files.pythonhosted.org/packages/8b/24/321ab83a709f52db73dcc89dd9c1a6574a7c058115e940a46547d41ed6ad/txt2cql-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-03 18:54:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "CentreonLabs",
"github_project": "txt2cql",
"github_not_found": true,
"lcname": "txt2cql"
}