Name | delos-cosmoshub JSON |
Version |
0.1.1
JSON |
| download |
home_page | None |
Summary | CosmosHub client. |
upload_time | 2024-11-21 09:31:58 |
maintainer | None |
docs_url | None |
author | Maria |
requires_python | <4.0,>=3.11 |
license | None |
keywords |
ai
llm
generative
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Delos CosmosHub
CosmosHub client for interacting with the CosmosHub API.
## Installation
To install the package, use `pip`:
```bash
pip install delos-cosmoshub
```
Or if you are using `poetry`:
```bash
poetry add delos-cosmoshub
```
## Client Initialization
You can create an **API key** to access all services through **CosmosPlatform**
`https://platform.cosmos-suite.ai/dashboard/keys`.
To create a `CosmosHub` client instance, you need to initialize it with your API key, and optionally the server URL:
```python
from delos_cosmoshub import CosmosHubClient
client = CosmosHubClient("your-api-key") # will be equivalent to:
client = CosmosHubClient("your-api-key", "https://platform.cosmos-suite.ai", debug_mode=False)
```
## Endpoints
This `delos-cosmoshub` client provides access to the following endpoints:
**Status Endpoints**
- `status_health_request`: Check the health of the server.
**Translate Endpoints**
- `translate_text_request`: Translate text.
- `translate_file_request`: Translate a file.
**Web Endpoints**
- `web_search_request`: Perform a web search.
**LLM Endpoints**
- `chat`: Chat with the LLM.
- `embed`: Embed data into the LLM.
**Files Endpoints**
- `files_chunker_request`: Chunk a file.
- `files_index_operation_request`: Index group a set of files in order to be able to query them using natural language.
- `files_index_operation_request`: Ask a question about the index documents (it requires that your
`index.status.vectorized` is set to `True`).
- `files_index_operation_request`: Embed data into an index.
- `files_index_operation_request`: List all indexes.
- `files_index_operation_request`: Get details of an index.
These endpoints are accessible through `delos-cosmoshub` client methods.
> ℹ️ **Info:** For all the **endpoints**, there are specific **models** that structure the data to be sent to the API.
>
> They may contain the `text` or `files` to operate with, the `output_language` for your result, the `index_uuid` that
> identifies the set of documents, the `model` to use for the LLM operations, etc.
>
> You can find them in the `delos_cosmoshub.models` module.
---
### Status Endpoints
#### Status Health Request
To **check the health** of the server and the validity of your API key:
```python
response = client.status_health_request()
if response:
print(f"Response: {response}")
```
---
### Translate Endpoints
#### 1. Translate Text Request
To **translate text**, you can use the `translate_text_request` method:
```python
from delos_cosmoshub.models import TranslateTextData
translate_data = TranslateTextData(text="Hello, world!", target_language="fr")
response = client.translate_text_request(translate_data)
if response:
print(f"Translated Text: {response}")
```
#### 2. Translate File Request
To **translate a file**, use the `translate_file_request` method:
```python
from delos_cosmoshub.models import TranslateFileData
translate_file_data = TranslateFileData(file=my_file, target_language="es")
response = client.translate_file_request(translate_file_data)
if response:
print(f"Translated File Response: {response}")
```
---
### Web Endpoints
#### Web Search Request
To perform a web search:
```python
from delos_cosmoshub.models import SearchData
search_data = SearchData(query="CosmosHub")
response = client.web_search_request(search_data)
if response:
print(f"Search Results: {response}")
```
---
### LLM Endpoints
#### 1. Chat Request
To **chat** with the LLM:
```python
from delos_cosmoshub.models import ChatData
chat_data = ChatData(text="Hello, how are you?", model="gpt-4o-mini")
response = client.chat(chat_data)
if response:
print(f"Chat Response: {response}")
```
#### 2. Embed Request
To **embed** data using a LLM:
```python
from delos_cosmoshub.models import EmbedData
embed_data = EmbedData(text="Hello, how are you?", model="ada-v2")
response = client.embed(embed_data)
if response:
print(f"Embed Response: {response}")
```
---
### Files Endpoints
#### Files Chunker Request
Universal reader and parser. To chunk a file:
```python
from delos_cosmoshub.models import ChunkerData
chunker_data = ChunkerData(file=my_file)
response = client.files_chunker_request(chunker_data)
if response:
print(f"Chunked File Response: {response}")
```
#### Files Index Operation Request
Index group a set of files in order to be able to query them using natural language. The following operations are
available:
- `INDEX_CREATE`: Create a new index and parse files.
- `INDEX_ADD_FILES`: Add files to an existing index.
- `INDEX_DELETE_FILES`: Delete files from an index.
- `INDEX_DELETE`: Delete an index. **Warning**: _This is a delayed (2h) operation, allowed to be reverted with
`INDEX_RESTORE`. After 2h, the index will be **deleted and not recoverable**._
- `INDEX_RESTORE`: Restore a deleted index _(within the 2h after it was marked for deletion)_.
- `INDEX_EMBED`: Embed data into an index.
- `INDEX_ASK`: Ask a question to the index. It requires that `INDEX_EMBED` is performed to allow index contents
querying.
- `INDEX_LIST`: List all indexes.
- `INDEX_DETAILS`: Get details of an index.
#### Examples
To **create a new index** and parse files:
```python
from delos_cosmoshub.data import IndexOperationData, FileEndpoints
index_operation_data = IndexOperationData(files=[my_file], index_uuid="new-index-uuid")
response = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_CREATE)
if response:
print(f"Index Create Response: {response}")
```
To **add files** to an existing index:
```python
index_operation_data = IndexOperationData(files=[my_file], index_uuid="existing-index-uuid")
response = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_ADD_FILES)
if response:
print(f"Add Files to Index Response: {response}")
```
To **delete files** from an existing index:
```python
index_operation_data = IndexOperationData(files=[my_file], index_uuid="existing-index-uuid")
response = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_DELETE_FILES)
if response:
print(f"Delete Files from Index Response: {response}")
```
To **delete an index** (it will be marked for deletion which will become effective after 2h):
```python
index_operation_data = IndexOperationData(index_uuid="index-to-delete-uuid")
response = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_DELETE)
if response:
print(f"Delete Index Response: {response}")
```
To **restore an index** marked for deletion (only possible during the 2h after the `INDEX_DELETE` was requested):
```python
index_operation_data = IndexOperationData(index_uuid="index-to-restore-uuid")
response = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_RESTORE)
if response:
print(f"Restore Index Response: {response}")
```
To **embed** or **vectorize index contents** in order to allow the query operations:
```python
index_operation_data = IndexOperationData(index_uuid="index-uuid", data_to_embed=my_data)
response = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_EMBED)
if response:
print(f"Embed Data Response: {response}")
```
To **ask a question** about the index documents (it requires that your `index.status.vectorized` is set to `True`):
```python
index_operation_data = IndexOperationData(index_uuid="index-uuid", question="What is CosmosHub?")
response = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_ASK)
if response:
print(f"Ask Index Response: {response}")
```
To **list all indexes** in your organization, files included and storage details:
```python
response = client.files_index_operation_request(None, FileEndpoints.INDEX_LIST)
if response:
print(f"List Indexes Response: {response}")
```
To **get details** of an index:
```python
index_operation_data = IndexOperationData(index_uuid="index-uuid")
response = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_DETAILS)
if response:
print(f"Index Details Response: {response}")
```
---
## Development
To contribute to the project, clone the repository and install the dependencies:
```bash
git clone https://github.com/yourusername/delos-cosmoshub.git
cd delos-cosmoshub
poetry install
```
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
## Contact
For any inquiries, please contact the project maintainers at support@cosmos-suite.ai.
Raw data
{
"_id": null,
"home_page": null,
"name": "delos-cosmoshub",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": "AI, LLM, generative",
"author": "Maria",
"author_email": "mariaibanez@delosintelligence.fr",
"download_url": "https://files.pythonhosted.org/packages/d5/96/04250162a92a5a60b39fd973f60eaa7d435a7d0fd7fb1c5b29fd4ef311b7/delos_cosmoshub-0.1.1.tar.gz",
"platform": null,
"description": "# Delos CosmosHub\n\nCosmosHub client for interacting with the CosmosHub API.\n\n## Installation\n\nTo install the package, use `pip`:\n\n```bash\npip install delos-cosmoshub\n```\n\nOr if you are using `poetry`:\n\n```bash\npoetry add delos-cosmoshub\n```\n\n## Client Initialization\n\nYou can create an **API key** to access all services through **CosmosPlatform**\n`https://platform.cosmos-suite.ai/dashboard/keys`.\n\nTo create a `CosmosHub` client instance, you need to initialize it with your API key, and optionally the server URL:\n\n```python\nfrom delos_cosmoshub import CosmosHubClient\n\nclient = CosmosHubClient(\"your-api-key\") # will be equivalent to:\nclient = CosmosHubClient(\"your-api-key\", \"https://platform.cosmos-suite.ai\", debug_mode=False)\n```\n\n## Endpoints\n\nThis `delos-cosmoshub` client provides access to the following endpoints:\n\n**Status Endpoints**\n\n- `status_health_request`: Check the health of the server.\n\n**Translate Endpoints**\n\n- `translate_text_request`: Translate text.\n- `translate_file_request`: Translate a file.\n\n**Web Endpoints**\n\n- `web_search_request`: Perform a web search.\n\n**LLM Endpoints**\n\n- `chat`: Chat with the LLM.\n- `embed`: Embed data into the LLM.\n\n**Files Endpoints**\n\n- `files_chunker_request`: Chunk a file.\n- `files_index_operation_request`: Index group a set of files in order to be able to query them using natural language.\n- `files_index_operation_request`: Ask a question about the index documents (it requires that your\n `index.status.vectorized` is set to `True`).\n- `files_index_operation_request`: Embed data into an index.\n- `files_index_operation_request`: List all indexes.\n- `files_index_operation_request`: Get details of an index.\n\nThese endpoints are accessible through `delos-cosmoshub` client methods.\n\n> \u2139\ufe0f **Info:** For all the **endpoints**, there are specific **models** that structure the data to be sent to the API.\n>\n> They may contain the `text` or `files` to operate with, the `output_language` for your result, the `index_uuid` that\n> identifies the set of documents, the `model` to use for the LLM operations, etc.\n>\n> You can find them in the `delos_cosmoshub.models` module.\n\n---\n\n### Status Endpoints\n\n#### Status Health Request\n\nTo **check the health** of the server and the validity of your API key:\n\n```python\nresponse = client.status_health_request()\nif response:\n print(f\"Response: {response}\")\n```\n\n---\n\n### Translate Endpoints\n\n#### 1. Translate Text Request\n\nTo **translate text**, you can use the `translate_text_request` method:\n\n```python\nfrom delos_cosmoshub.models import TranslateTextData\n\ntranslate_data = TranslateTextData(text=\"Hello, world!\", target_language=\"fr\")\nresponse = client.translate_text_request(translate_data)\nif response:\n print(f\"Translated Text: {response}\")\n```\n\n#### 2. Translate File Request\n\nTo **translate a file**, use the `translate_file_request` method:\n\n```python\nfrom delos_cosmoshub.models import TranslateFileData\n\ntranslate_file_data = TranslateFileData(file=my_file, target_language=\"es\")\nresponse = client.translate_file_request(translate_file_data)\nif response:\n print(f\"Translated File Response: {response}\")\n```\n\n---\n\n### Web Endpoints\n\n#### Web Search Request\n\nTo perform a web search:\n\n```python\nfrom delos_cosmoshub.models import SearchData\n\nsearch_data = SearchData(query=\"CosmosHub\")\nresponse = client.web_search_request(search_data)\nif response:\n print(f\"Search Results: {response}\")\n```\n\n---\n\n### LLM Endpoints\n\n#### 1. Chat Request\n\nTo **chat** with the LLM:\n\n```python\nfrom delos_cosmoshub.models import ChatData\n\nchat_data = ChatData(text=\"Hello, how are you?\", model=\"gpt-4o-mini\")\nresponse = client.chat(chat_data)\nif response:\n print(f\"Chat Response: {response}\")\n```\n\n#### 2. Embed Request\n\nTo **embed** data using a LLM:\n\n```python\nfrom delos_cosmoshub.models import EmbedData\n\nembed_data = EmbedData(text=\"Hello, how are you?\", model=\"ada-v2\")\nresponse = client.embed(embed_data)\nif response:\n print(f\"Embed Response: {response}\")\n```\n\n---\n\n### Files Endpoints\n\n#### Files Chunker Request\n\nUniversal reader and parser. To chunk a file:\n\n```python\nfrom delos_cosmoshub.models import ChunkerData\n\nchunker_data = ChunkerData(file=my_file)\nresponse = client.files_chunker_request(chunker_data)\nif response:\n print(f\"Chunked File Response: {response}\")\n```\n\n#### Files Index Operation Request\n\nIndex group a set of files in order to be able to query them using natural language. The following operations are\navailable:\n\n- `INDEX_CREATE`: Create a new index and parse files.\n- `INDEX_ADD_FILES`: Add files to an existing index.\n- `INDEX_DELETE_FILES`: Delete files from an index.\n- `INDEX_DELETE`: Delete an index. **Warning**: _This is a delayed (2h) operation, allowed to be reverted with\n `INDEX_RESTORE`. After 2h, the index will be **deleted and not recoverable**._\n- `INDEX_RESTORE`: Restore a deleted index _(within the 2h after it was marked for deletion)_.\n- `INDEX_EMBED`: Embed data into an index.\n- `INDEX_ASK`: Ask a question to the index. It requires that `INDEX_EMBED` is performed to allow index contents\n querying.\n- `INDEX_LIST`: List all indexes.\n- `INDEX_DETAILS`: Get details of an index.\n\n#### Examples\n\nTo **create a new index** and parse files:\n\n```python\nfrom delos_cosmoshub.data import IndexOperationData, FileEndpoints\n\nindex_operation_data = IndexOperationData(files=[my_file], index_uuid=\"new-index-uuid\")\nresponse = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_CREATE)\nif response:\n print(f\"Index Create Response: {response}\")\n```\n\nTo **add files** to an existing index:\n\n```python\nindex_operation_data = IndexOperationData(files=[my_file], index_uuid=\"existing-index-uuid\")\nresponse = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_ADD_FILES)\nif response:\n print(f\"Add Files to Index Response: {response}\")\n```\n\nTo **delete files** from an existing index:\n\n```python\nindex_operation_data = IndexOperationData(files=[my_file], index_uuid=\"existing-index-uuid\")\nresponse = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_DELETE_FILES)\nif response:\n print(f\"Delete Files from Index Response: {response}\")\n```\n\nTo **delete an index** (it will be marked for deletion which will become effective after 2h):\n\n```python\nindex_operation_data = IndexOperationData(index_uuid=\"index-to-delete-uuid\")\nresponse = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_DELETE)\nif response:\n print(f\"Delete Index Response: {response}\")\n```\n\nTo **restore an index** marked for deletion (only possible during the 2h after the `INDEX_DELETE` was requested):\n\n```python\nindex_operation_data = IndexOperationData(index_uuid=\"index-to-restore-uuid\")\nresponse = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_RESTORE)\nif response:\n print(f\"Restore Index Response: {response}\")\n```\n\nTo **embed** or **vectorize index contents** in order to allow the query operations:\n\n```python\nindex_operation_data = IndexOperationData(index_uuid=\"index-uuid\", data_to_embed=my_data)\nresponse = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_EMBED)\nif response:\n print(f\"Embed Data Response: {response}\")\n```\n\nTo **ask a question** about the index documents (it requires that your `index.status.vectorized` is set to `True`):\n\n```python\nindex_operation_data = IndexOperationData(index_uuid=\"index-uuid\", question=\"What is CosmosHub?\")\nresponse = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_ASK)\nif response:\n print(f\"Ask Index Response: {response}\")\n```\n\nTo **list all indexes** in your organization, files included and storage details:\n\n```python\nresponse = client.files_index_operation_request(None, FileEndpoints.INDEX_LIST)\nif response:\n print(f\"List Indexes Response: {response}\")\n```\n\nTo **get details** of an index:\n\n```python\nindex_operation_data = IndexOperationData(index_uuid=\"index-uuid\")\nresponse = client.files_index_operation_request(index_operation_data, FileEndpoints.INDEX_DETAILS)\nif response:\n print(f\"Index Details Response: {response}\")\n```\n\n---\n\n## Development\n\nTo contribute to the project, clone the repository and install the dependencies:\n\n```bash\ngit clone https://github.com/yourusername/delos-cosmoshub.git\ncd delos-cosmoshub\npoetry install\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n## Contact\n\nFor any inquiries, please contact the project maintainers at support@cosmos-suite.ai.\n\n",
"bugtrack_url": null,
"license": null,
"summary": "CosmosHub client.",
"version": "0.1.1",
"project_urls": null,
"split_keywords": [
"ai",
" llm",
" generative"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8d6bbf8a9715b63c38486df51eed1ac437455cad1b14561b6b4db7d06decbabe",
"md5": "6f0afc3b51e3a891eea2156492c5e7da",
"sha256": "249d333db816c9f2a66994c1edc8049c3ec86eb0cee3f4da730b6b71682cc9bb"
},
"downloads": -1,
"filename": "delos_cosmoshub-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6f0afc3b51e3a891eea2156492c5e7da",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 8900,
"upload_time": "2024-11-21T09:31:56",
"upload_time_iso_8601": "2024-11-21T09:31:56.221098Z",
"url": "https://files.pythonhosted.org/packages/8d/6b/bf8a9715b63c38486df51eed1ac437455cad1b14561b6b4db7d06decbabe/delos_cosmoshub-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d59604250162a92a5a60b39fd973f60eaa7d435a7d0fd7fb1c5b29fd4ef311b7",
"md5": "f82a9f60751b23eba7dbfdadfd1a49aa",
"sha256": "99fec8c4b541c4f07bd5d0fc0712e6842b6b494e1fccf702c3bd262b99dbb2ce"
},
"downloads": -1,
"filename": "delos_cosmoshub-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "f82a9f60751b23eba7dbfdadfd1a49aa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 8785,
"upload_time": "2024-11-21T09:31:58",
"upload_time_iso_8601": "2024-11-21T09:31:58.287684Z",
"url": "https://files.pythonhosted.org/packages/d5/96/04250162a92a5a60b39fd973f60eaa7d435a7d0fd7fb1c5b29fd4ef311b7/delos_cosmoshub-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-21 09:31:58",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "delos-cosmoshub"
}