```markdown
# Neuron Chat Client
This is a Python client library for interacting with the Neuron chat API. It allows you to easily send messages to the API and receive responses.
## Installation
You can install the library using pip:
```bash
pip install neuronexpert
```
## Usage
Here is an example of how to use the `Neuron` class to interact with the Neuron chat API:
### Basic Usage
First, import the `Neuron` class and create an instance of it with your `chat_id` and `api_key`.
```python
from neuronexpert import Neuron
# Initialize the Neuron client
client = Neuron(chat_id=12345, api_key='your-api-key')
# Ask a question
answer = client.ask("Hello, how are you?")
print(answer)
```
### Detailed Example
Here is a more detailed example demonstrating how to handle errors and format the response:
```python
from neuronexpert import Neuron
def main():
# Replace with your actual chat_id and API key
chat_id = 12345
api_key = 'your-api-key'
# Initialize the Neuron client
client = Neuron(chat_id=chat_id, api_key=api_key)
# Ask a question
question = "What is the weather like today?"
try:
# Get the answer from the Neuron API
answer = client.ask(question)
print(f"Question: {question}")
print(f"Answer: {answer}")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
main()
```
### Class Documentation
#### `Neuron` Class
**Initialization**:
```python
client = Neuron(chat_id: int, api_key: str)
```
- `chat_id`: The ID of the chat session.
- `api_key`: Your API key for accessing the Neuron chat API.
**Methods**:
- `ask(message: str) -> str`: Sends a message to the Neuron chat API and returns the response.
- `message`: The message you want to send to the API.
### Error Handling
The `ask` method includes error handling for various types of errors that might occur during the request. If an error occurs, it will be printed to the console.
### Dependencies
This library depends on `aiohttp` for making asynchronous HTTP requests. The dependency is listed in `setup.py` and will be installed automatically when you install the package.
## Development
If you want to contribute to the development of this library, you can clone the repository and install the dependencies:
```bash
git clone https://github.com/nnevdokimov/neuronexpert.git
cd neuronexpert
pip install -r requirements.txt
```
## License
This project is licensed under the MIT License. See the `LICENSE` file for more details.
---
Feel free to customize the examples and usage instructions to better fit your needs. If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request on GitHub.
```
Raw data
{
"_id": null,
"home_page": "https://neuron.expert",
"name": "neuronexpert",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "neuron expert",
"author": "percyve11e",
"author_email": "percyve11e.me@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c9/97/41a15dcf30dc80ea46a9dcaad8c5255952eaa8f35bdcc317c6beb389f4e0/neuronexpert-1.0.2.tar.gz",
"platform": null,
"description": "```markdown\n# Neuron Chat Client\n\nThis is a Python client library for interacting with the Neuron chat API. It allows you to easily send messages to the API and receive responses.\n\n## Installation\n\nYou can install the library using pip:\n\n```bash\npip install neuronexpert\n```\n\n## Usage\n\nHere is an example of how to use the `Neuron` class to interact with the Neuron chat API:\n\n### Basic Usage\n\nFirst, import the `Neuron` class and create an instance of it with your `chat_id` and `api_key`.\n\n```python\nfrom neuronexpert import Neuron\n\n# Initialize the Neuron client\nclient = Neuron(chat_id=12345, api_key='your-api-key')\n\n# Ask a question\nanswer = client.ask(\"Hello, how are you?\")\nprint(answer)\n```\n\n### Detailed Example\n\nHere is a more detailed example demonstrating how to handle errors and format the response:\n\n```python\nfrom neuronexpert import Neuron\n\ndef main():\n # Replace with your actual chat_id and API key\n chat_id = 12345\n api_key = 'your-api-key'\n \n # Initialize the Neuron client\n client = Neuron(chat_id=chat_id, api_key=api_key)\n \n # Ask a question\n question = \"What is the weather like today?\"\n \n try:\n # Get the answer from the Neuron API\n answer = client.ask(question)\n print(f\"Question: {question}\")\n print(f\"Answer: {answer}\")\n except Exception as e:\n print(f\"An error occurred: {e}\")\n\nif __name__ == \"__main__\":\n main()\n```\n\n### Class Documentation\n\n#### `Neuron` Class\n\n**Initialization**:\n\n```python\nclient = Neuron(chat_id: int, api_key: str)\n```\n\n- `chat_id`: The ID of the chat session.\n- `api_key`: Your API key for accessing the Neuron chat API.\n\n**Methods**:\n\n- `ask(message: str) -> str`: Sends a message to the Neuron chat API and returns the response.\n - `message`: The message you want to send to the API.\n\n### Error Handling\n\nThe `ask` method includes error handling for various types of errors that might occur during the request. If an error occurs, it will be printed to the console.\n\n### Dependencies\n\nThis library depends on `aiohttp` for making asynchronous HTTP requests. The dependency is listed in `setup.py` and will be installed automatically when you install the package.\n\n## Development\n\nIf you want to contribute to the development of this library, you can clone the repository and install the dependencies:\n\n```bash\ngit clone https://github.com/nnevdokimov/neuronexpert.git\ncd neuronexpert\npip install -r requirements.txt\n```\n\n## License\n\nThis project is licensed under the MIT License. See the `LICENSE` file for more details.\n\n---\n\nFeel free to customize the examples and usage instructions to better fit your needs. If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request on GitHub.\n\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "This is the lib to use Neuron Expert Assistant",
"version": "1.0.2",
"project_urls": {
"GitHub": "https://github.com/nnevdokimov",
"Homepage": "https://neuron.expert"
},
"split_keywords": [
"neuron",
"expert"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fe8d199661d0074949a7df771af42b0c9c82f3ccb0c3dddaf77de898b65f4f44",
"md5": "a91cda99d5f620f8c76f2428ddf1fdaa",
"sha256": "635fadc951406ea4e14473d931dd8a5878b47f0aa2c1a7bb074dd7984b78ae74"
},
"downloads": -1,
"filename": "neuronexpert-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a91cda99d5f620f8c76f2428ddf1fdaa",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 3448,
"upload_time": "2024-06-21T22:19:11",
"upload_time_iso_8601": "2024-06-21T22:19:11.952756Z",
"url": "https://files.pythonhosted.org/packages/fe/8d/199661d0074949a7df771af42b0c9c82f3ccb0c3dddaf77de898b65f4f44/neuronexpert-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c99741a15dcf30dc80ea46a9dcaad8c5255952eaa8f35bdcc317c6beb389f4e0",
"md5": "a058102fe04361d1c312122909ba1fcc",
"sha256": "8afa2ca4b75904be465ed1b5f0c366d4c04bf476edf56fbeab1b5c71f540930f"
},
"downloads": -1,
"filename": "neuronexpert-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "a058102fe04361d1c312122909ba1fcc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3220,
"upload_time": "2024-06-21T22:19:16",
"upload_time_iso_8601": "2024-06-21T22:19:16.740503Z",
"url": "https://files.pythonhosted.org/packages/c9/97/41a15dcf30dc80ea46a9dcaad8c5255952eaa8f35bdcc317c6beb389f4e0/neuronexpert-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-21 22:19:16",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "neuronexpert"
}