neurocli-sdk 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- neurocli_sdk-1.0.0/PKG-INFO +59 -0
- neurocli_sdk-1.0.0/README.md +38 -0
- neurocli_sdk-1.0.0/neurocli/__init__.py +3 -0
- neurocli_sdk-1.0.0/neurocli/client.py +74 -0
- neurocli_sdk-1.0.0/neurocli_sdk.egg-info/PKG-INFO +59 -0
- neurocli_sdk-1.0.0/neurocli_sdk.egg-info/SOURCES.txt +10 -0
- neurocli_sdk-1.0.0/neurocli_sdk.egg-info/dependency_links.txt +1 -0
- neurocli_sdk-1.0.0/neurocli_sdk.egg-info/requires.txt +1 -0
- neurocli_sdk-1.0.0/neurocli_sdk.egg-info/top_level.txt +1 -0
- neurocli_sdk-1.0.0/pyproject.toml +27 -0
- neurocli_sdk-1.0.0/setup.cfg +4 -0
- neurocli_sdk-1.0.0/setup.py +26 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neurocli-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: The official Python SDK for the NeuroCLI API
|
|
5
|
+
Home-page: https://www.neurocli.in
|
|
6
|
+
Author: NeuroCLI
|
|
7
|
+
Author-email: NeuroCLI <info@neurocli.in>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://www.neurocli.in
|
|
10
|
+
Project-URL: Documentation, https://www.neurocli.in/docs
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Requires-Python: >=3.7
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: requests>=2.20.0
|
|
18
|
+
Dynamic: author
|
|
19
|
+
Dynamic: home-page
|
|
20
|
+
Dynamic: requires-python
|
|
21
|
+
|
|
22
|
+
# NeuroCLI Python SDK
|
|
23
|
+
|
|
24
|
+
The official Python library for the NeuroCLI API.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
You can install this SDK locally:
|
|
29
|
+
```bash
|
|
30
|
+
pip install -e .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
The SDK mimics the standard OpenAI Python client interface, making it extremely easy to drop into existing AI applications.
|
|
36
|
+
|
|
37
|
+
### Basic Chat Completion
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
import neurocli
|
|
41
|
+
|
|
42
|
+
# Initialize the client
|
|
43
|
+
client = neurocli.NeuroCLI(
|
|
44
|
+
api_key="ncli_YOUR_SECRET_KEY",
|
|
45
|
+
# During local testing, point this to your local server:
|
|
46
|
+
# base_url="http://127.0.0.1:8000/api/ai"
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# Generate a response
|
|
50
|
+
response = client.chat.completions.create(
|
|
51
|
+
model="meta/llama-3.1-8b-instruct",
|
|
52
|
+
messages=[
|
|
53
|
+
{"role": "user", "content": "Explain quantum computing in simple terms."}
|
|
54
|
+
],
|
|
55
|
+
temperature=0.7
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
print(response.choices[0].message.content)
|
|
59
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# NeuroCLI Python SDK
|
|
2
|
+
|
|
3
|
+
The official Python library for the NeuroCLI API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
You can install this SDK locally:
|
|
8
|
+
```bash
|
|
9
|
+
pip install -e .
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
The SDK mimics the standard OpenAI Python client interface, making it extremely easy to drop into existing AI applications.
|
|
15
|
+
|
|
16
|
+
### Basic Chat Completion
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
import neurocli
|
|
20
|
+
|
|
21
|
+
# Initialize the client
|
|
22
|
+
client = neurocli.NeuroCLI(
|
|
23
|
+
api_key="ncli_YOUR_SECRET_KEY",
|
|
24
|
+
# During local testing, point this to your local server:
|
|
25
|
+
# base_url="http://127.0.0.1:8000/api/ai"
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# Generate a response
|
|
29
|
+
response = client.chat.completions.create(
|
|
30
|
+
model="meta/llama-3.1-8b-instruct",
|
|
31
|
+
messages=[
|
|
32
|
+
{"role": "user", "content": "Explain quantum computing in simple terms."}
|
|
33
|
+
],
|
|
34
|
+
temperature=0.7
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
print(response.choices[0].message.content)
|
|
38
|
+
```
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
from typing import List, Dict, Optional, Any
|
|
3
|
+
|
|
4
|
+
class ChatCompletions:
|
|
5
|
+
def __init__(self, client):
|
|
6
|
+
self._client = client
|
|
7
|
+
|
|
8
|
+
def create(
|
|
9
|
+
self,
|
|
10
|
+
model: str,
|
|
11
|
+
messages: List[Dict[str, str]],
|
|
12
|
+
temperature: Optional[float] = None,
|
|
13
|
+
max_tokens: Optional[int] = None,
|
|
14
|
+
**kwargs
|
|
15
|
+
) -> Any:
|
|
16
|
+
|
|
17
|
+
payload = {
|
|
18
|
+
"model": model,
|
|
19
|
+
"messages": messages,
|
|
20
|
+
}
|
|
21
|
+
if temperature is not None:
|
|
22
|
+
payload["temperature"] = temperature
|
|
23
|
+
if max_tokens is not None:
|
|
24
|
+
payload["max_tokens"] = max_tokens
|
|
25
|
+
|
|
26
|
+
payload.update(kwargs)
|
|
27
|
+
|
|
28
|
+
headers = {
|
|
29
|
+
"Content-Type": "application/json",
|
|
30
|
+
"Authorization": f"Bearer {self._client.api_key}"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
response = requests.post(
|
|
34
|
+
f"{self._client.base_url}/chat/completions",
|
|
35
|
+
json=payload,
|
|
36
|
+
headers=headers
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
response.raise_for_status()
|
|
40
|
+
|
|
41
|
+
data = response.json()
|
|
42
|
+
|
|
43
|
+
# Simple object wrapper for dot notation access (response.choices[0].message.content)
|
|
44
|
+
class ResponseWrapper:
|
|
45
|
+
def __init__(self, data_dict):
|
|
46
|
+
self.__dict__.update(data_dict)
|
|
47
|
+
if hasattr(self, 'choices') and isinstance(self.choices, list):
|
|
48
|
+
self.choices = [
|
|
49
|
+
type('Choice', (object,), {
|
|
50
|
+
'message': type('Message', (object,), choice.get('message', {})),
|
|
51
|
+
'finish_reason': choice.get('finish_reason')
|
|
52
|
+
}) for choice in self.choices
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
return ResponseWrapper(data)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class Chat:
|
|
59
|
+
def __init__(self, client):
|
|
60
|
+
self.completions = ChatCompletions(client)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class NeuroCLI:
|
|
64
|
+
def __init__(self, api_key: str, base_url: str = "https://www.neurocli.in/v1"):
|
|
65
|
+
"""
|
|
66
|
+
Initialize the NeuroCLI client.
|
|
67
|
+
|
|
68
|
+
:param api_key: Your secret API key starting with 'ncli_'
|
|
69
|
+
:param base_url: The base API URL. During development, point this to your local server.
|
|
70
|
+
"""
|
|
71
|
+
self.api_key = api_key
|
|
72
|
+
# Strip trailing slash if present
|
|
73
|
+
self.base_url = base_url.rstrip("/")
|
|
74
|
+
self.chat = Chat(self)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neurocli-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: The official Python SDK for the NeuroCLI API
|
|
5
|
+
Home-page: https://www.neurocli.in
|
|
6
|
+
Author: NeuroCLI
|
|
7
|
+
Author-email: NeuroCLI <info@neurocli.in>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://www.neurocli.in
|
|
10
|
+
Project-URL: Documentation, https://www.neurocli.in/docs
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Requires-Python: >=3.7
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: requests>=2.20.0
|
|
18
|
+
Dynamic: author
|
|
19
|
+
Dynamic: home-page
|
|
20
|
+
Dynamic: requires-python
|
|
21
|
+
|
|
22
|
+
# NeuroCLI Python SDK
|
|
23
|
+
|
|
24
|
+
The official Python library for the NeuroCLI API.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
You can install this SDK locally:
|
|
29
|
+
```bash
|
|
30
|
+
pip install -e .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
The SDK mimics the standard OpenAI Python client interface, making it extremely easy to drop into existing AI applications.
|
|
36
|
+
|
|
37
|
+
### Basic Chat Completion
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
import neurocli
|
|
41
|
+
|
|
42
|
+
# Initialize the client
|
|
43
|
+
client = neurocli.NeuroCLI(
|
|
44
|
+
api_key="ncli_YOUR_SECRET_KEY",
|
|
45
|
+
# During local testing, point this to your local server:
|
|
46
|
+
# base_url="http://127.0.0.1:8000/api/ai"
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# Generate a response
|
|
50
|
+
response = client.chat.completions.create(
|
|
51
|
+
model="meta/llama-3.1-8b-instruct",
|
|
52
|
+
messages=[
|
|
53
|
+
{"role": "user", "content": "Explain quantum computing in simple terms."}
|
|
54
|
+
],
|
|
55
|
+
temperature=0.7
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
print(response.choices[0].message.content)
|
|
59
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
setup.py
|
|
4
|
+
neurocli/__init__.py
|
|
5
|
+
neurocli/client.py
|
|
6
|
+
neurocli_sdk.egg-info/PKG-INFO
|
|
7
|
+
neurocli_sdk.egg-info/SOURCES.txt
|
|
8
|
+
neurocli_sdk.egg-info/dependency_links.txt
|
|
9
|
+
neurocli_sdk.egg-info/requires.txt
|
|
10
|
+
neurocli_sdk.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.20.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
neurocli
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "neurocli-sdk"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "The official Python SDK for the NeuroCLI API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.7"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name="NeuroCLI", email="info@neurocli.in" },
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"requests>=2.20.0",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
"Homepage" = "https://www.neurocli.in"
|
|
27
|
+
"Documentation" = "https://www.neurocli.in/docs"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r", encoding="utf-8") as fh:
|
|
4
|
+
long_description = fh.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name="neurocli-sdk",
|
|
8
|
+
version="1.0.0",
|
|
9
|
+
description="The official Python SDK for the NeuroCLI API.",
|
|
10
|
+
long_description=long_description,
|
|
11
|
+
long_description_content_type="text/markdown",
|
|
12
|
+
author="NeuroCLI",
|
|
13
|
+
author_email="info@neurocli.in",
|
|
14
|
+
url="https://www.neurocli.in",
|
|
15
|
+
packages=find_packages(),
|
|
16
|
+
install_requires=[
|
|
17
|
+
"requests>=2.20.0"
|
|
18
|
+
],
|
|
19
|
+
classifiers=[
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Intended Audience :: Developers",
|
|
24
|
+
],
|
|
25
|
+
python_requires=">=3.7",
|
|
26
|
+
)
|