# Crypto.com AI Agent Client.py
The Crypto.com AI Agent Client.py is a Python library designed to facilitate easy and efficient interactions with the Crypto.com AI Agent Service API. This client library provides methods to send queries and fetch responses from the Crypto.com AI Agent Service seamlessly.
![PyPI](https://img.shields.io/pypi/v/crypto-com-ai-agent-client)
## Features
- Simple and intuitive API for interacting with the Crypto.com AI Agent.
- Supports sending queries and receiving AI-generated responses.
- Configurable client instances tailored to your specific endpoint and security needs.
- **Currently in beta**: Expect frequent updates and potential changes in future releases.
## Installation
To install the package, run the following command:
```bash
pip install crypto_com_ai_agent_client
```
## Usage
Here’s how you can use the Crypto.com AI Agent Client in your project:
### Configuring the Client
```py
from crypto_com_ai_agent_client import create_client
client = create_client({
'openAI': {
'apiKey': 'YOUR_OPEN_AI_API_KEY',
'model': 'gpt-4o' # Optional, defaults to 'gpt-4-turbo'
},
'chainId': 25, # 25 for Cronos EVM Mainnet, 338 for Cronos EVM Testnet, 388 for Cronos ZkEVM Mainnet, 240 for Cronos ZkEVM Testnet
'explorerKeys': {
'cronosMainnetKey': 'CRONOS_MAINNET_API_KEY',
'cronosTestnetKey': 'CRONOS_TESTNET_API_KEY',
'cronosZkEvmKey': 'CRONOS_ZKEVM_API_KEY',
'cronosZkEvmTestnetKey': 'CRONOS_ZKEVM_TESTNET_API_KEY'
},
'context': [], # Optional
'signerAppUrl': 'https://my-signer-app', # Optional
'customRPC': 'https://rpc.vvs.finance' # Optional, if not provided, the default RPC for the chainId will be used
})
```
### Sending a Query
```py
import json
def send_query(query):
try:
response = client.agent.generate_query(query)
print('Crypto.com AI Agent Response:', json.dumps(response.to_dict(), indent=2))
except Exception as e:
print(f"Error sending query: {str(e)}")
send_query("What is the latest block?")
```
## API
### Client Methods
- `generate_query(query)`: Generates a query that is sent to the Crypto.com AI Agent Service and returns a response.
### Configuration Options
- `openAI`: Dictionary containing OpenAI configuration
- `apiKey`: Your OpenAI API key
- `model`: (Optional) The model to use (defaults to 'gpt-4-turbo')
- `chainId`: The ID of the blockchain network (25 for Cronos EVM Mainnet, 338 for Cronos EVM Testnet, 388 for Cronos ZkEVM Mainnet, 240 for Cronos ZkEVM Testnet)
- `explorerKeys`: Dictionary of API keys for different explorers, ensure that the keys match the chainId
- `cronosMainnetKey`: (Optional) API key for Cronos Mainnet
- `cronosTestnetKey`: (Optional) API key for Cronos Testnet
- `cronosZkEvmKey`: (Optional) API key for Cronos ZkEVM
- `cronosZkEvmTestnetKey`: (Optional) API key for Cronos ZkEVM Testnet
- `signerAppUrl`: (Optional) URL for the signer app
- `context`: (Optional) List of context items for the query
- `customRPC`: (Optional) Custom RPC URL, if not provided, the default RPC for the chainId will be used
## Licensing
The code in this project is licensed under the MIT license.
## Contact
If you have any questions or comments about the library, please feel free to open an issue or a pull request on our GitHub repository.
Raw data
{
"_id": null,
"home_page": "https://github.com/crypto-com/cdc-ai-agent-client-py",
"name": "crypto-com-ai-agent-client",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.8.1",
"maintainer_email": null,
"keywords": "agent, blockchain, crypto.com, AI, CDC",
"author": "Ric Arcifa",
"author_email": "ricardo.arcifa@crypto.com",
"download_url": null,
"platform": null,
"description": "# Crypto.com AI Agent Client.py\n\nThe Crypto.com AI Agent Client.py is a Python library designed to facilitate easy and efficient interactions with the Crypto.com AI Agent Service API. This client library provides methods to send queries and fetch responses from the Crypto.com AI Agent Service seamlessly.\n\n![PyPI](https://img.shields.io/pypi/v/crypto-com-ai-agent-client)\n\n## Features\n\n- Simple and intuitive API for interacting with the Crypto.com AI Agent.\n- Supports sending queries and receiving AI-generated responses.\n- Configurable client instances tailored to your specific endpoint and security needs.\n- **Currently in beta**: Expect frequent updates and potential changes in future releases.\n\n## Installation\n\nTo install the package, run the following command:\n\n```bash\npip install crypto_com_ai_agent_client\n```\n\n## Usage\n\nHere\u2019s how you can use the Crypto.com AI Agent Client in your project:\n\n### Configuring the Client\n\n```py\nfrom crypto_com_ai_agent_client import create_client\n\nclient = create_client({\n 'openAI': {\n 'apiKey': 'YOUR_OPEN_AI_API_KEY',\n 'model': 'gpt-4o' # Optional, defaults to 'gpt-4-turbo'\n },\n 'chainId': 25, # 25 for Cronos EVM Mainnet, 338 for Cronos EVM Testnet, 388 for Cronos ZkEVM Mainnet, 240 for Cronos ZkEVM Testnet\n 'explorerKeys': {\n 'cronosMainnetKey': 'CRONOS_MAINNET_API_KEY',\n 'cronosTestnetKey': 'CRONOS_TESTNET_API_KEY',\n 'cronosZkEvmKey': 'CRONOS_ZKEVM_API_KEY',\n 'cronosZkEvmTestnetKey': 'CRONOS_ZKEVM_TESTNET_API_KEY'\n },\n 'context': [], # Optional\n 'signerAppUrl': 'https://my-signer-app', # Optional\n 'customRPC': 'https://rpc.vvs.finance' # Optional, if not provided, the default RPC for the chainId will be used\n})\n```\n\n### Sending a Query\n\n```py\nimport json\n\ndef send_query(query):\n try:\n response = client.agent.generate_query(query)\n print('Crypto.com AI Agent Response:', json.dumps(response.to_dict(), indent=2))\n except Exception as e:\n print(f\"Error sending query: {str(e)}\")\n\nsend_query(\"What is the latest block?\")\n```\n\n## API\n\n### Client Methods\n\n- `generate_query(query)`: Generates a query that is sent to the Crypto.com AI Agent Service and returns a response.\n\n### Configuration Options\n\n- `openAI`: Dictionary containing OpenAI configuration\n - `apiKey`: Your OpenAI API key\n - `model`: (Optional) The model to use (defaults to 'gpt-4-turbo')\n- `chainId`: The ID of the blockchain network (25 for Cronos EVM Mainnet, 338 for Cronos EVM Testnet, 388 for Cronos ZkEVM Mainnet, 240 for Cronos ZkEVM Testnet)\n- `explorerKeys`: Dictionary of API keys for different explorers, ensure that the keys match the chainId\n - `cronosMainnetKey`: (Optional) API key for Cronos Mainnet\n - `cronosTestnetKey`: (Optional) API key for Cronos Testnet\n - `cronosZkEvmKey`: (Optional) API key for Cronos ZkEVM\n - `cronosZkEvmTestnetKey`: (Optional) API key for Cronos ZkEVM Testnet\n- `signerAppUrl`: (Optional) URL for the signer app\n- `context`: (Optional) List of context items for the query\n- `customRPC`: (Optional) Custom RPC URL, if not provided, the default RPC for the chainId will be used\n\n## Licensing\n\nThe code in this project is licensed under the MIT license.\n\n## Contact\n\nIf you have any questions or comments about the library, please feel free to open an issue or a pull request on our GitHub repository.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A python client to interact with the crypto.com AI agent service",
"version": "1.0.5",
"project_urls": {
"Documentation": "https://github.com/crypto-com/cdc-ai-agent-client-py",
"Homepage": "https://github.com/crypto-com/cdc-ai-agent-client-py",
"Repository": "https://github.com/crypto-com/cdc-ai-agent-client-py"
},
"split_keywords": [
"agent",
" blockchain",
" crypto.com",
" ai",
" cdc"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f3abce155027e4d1c93b82772fe6228ac1bffbf02f253af6badc2dd47823e521",
"md5": "b817ea91dcabb27778491b222aa50da2",
"sha256": "5ca3700200b2a17f6955c86c2bff0ca17b8015a91e6f1058148c03285903d5df"
},
"downloads": -1,
"filename": "crypto_com_ai_agent_client-1.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b817ea91dcabb27778491b222aa50da2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.8.1",
"size": 8081,
"upload_time": "2024-11-25T12:35:19",
"upload_time_iso_8601": "2024-11-25T12:35:19.112757Z",
"url": "https://files.pythonhosted.org/packages/f3/ab/ce155027e4d1c93b82772fe6228ac1bffbf02f253af6badc2dd47823e521/crypto_com_ai_agent_client-1.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-25 12:35:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "crypto-com",
"github_project": "cdc-ai-agent-client-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "crypto-com-ai-agent-client"
}