opengradient 0.3.14__py3-none-any.whl → 0.3.15__py3-none-any.whl

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.
opengradient/__init__.py CHANGED
@@ -5,7 +5,7 @@ from .defaults import DEFAULT_INFERENCE_CONTRACT_ADDRESS, DEFAULT_RPC_URL
5
5
  from .types import InferenceMode, LLM
6
6
  from . import llm
7
7
 
8
- __version__ = "0.3.14"
8
+ __version__ = "0.3.15"
9
9
 
10
10
  _client = None
11
11
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: opengradient
3
- Version: 0.3.14
3
+ Version: 0.3.15
4
4
  Summary: Python SDK for OpenGradient decentralized model management & inference services
5
5
  Project-URL: Homepage, https://opengradient.ai
6
6
  Author-email: OpenGradient <oliver@opengradient.ai>
@@ -183,6 +183,39 @@ og.infer(model_cid, model_inputs, inference_mode)
183
183
  ```
184
184
  - inference mode can be `VANILLA`, `ZKML`, or `TEE`
185
185
 
186
+ ### LLM Inference
187
+ #### LLM Completion
188
+ ```python
189
+ tx_hash, response = og.llm_completion(
190
+ model_cid='meta-llama/Meta-Llama-3-8B-Instruct',
191
+ prompt="Translate the following English text to French: 'Hello, how are you?'",
192
+ max_tokens=50,
193
+ temperature=0.0
194
+ )
195
+ ```
196
+
197
+ #### LLM Chat
198
+ ```python
199
+ # create messages history
200
+ messages = [
201
+ {
202
+ "role": "system",
203
+ "content": "You are a helpful AI assistant.",
204
+ "name": "HAL"
205
+ },
206
+ {
207
+ "role": "user",
208
+ "content": "Hello! How are you doing? Can you repeat my name?",
209
+ }]
210
+
211
+ # run LLM inference
212
+ tx_hash, finish_reason, message = og.llm_chat(
213
+ model_cid=og.LLM.MISTRAL_7B_INSTRUCT_V3,
214
+ messages=messages
215
+ )
216
+ ```
217
+
218
+
186
219
 
187
220
  ## Using the CLI
188
221
 
@@ -223,8 +256,18 @@ opengradient infer QmbUqS93oc4JTLMHwpVxsE39mhNxy6hpf6Py3r9oANr8aZ VANILLA --inpu
223
256
  ```
224
257
 
225
258
  #### Run LLM Inference
259
+ We also have explicit support for using LLMs through the completion and chat commands in the CLI.
260
+
261
+ For example, you can run a competion inference with Llama-3 using the following command:
262
+
263
+ ``` bash
264
+ opengradient completion --model "meta-llama/Meta-Llama-3-8B-Instruct" --prompt "hello who are you?" --max-tokens 50
265
+ ```
266
+
267
+ Or you can use files instead of text input in order to simplify your command:
268
+
226
269
  ```bash
227
- opengradient llm --model "meta-llama/Meta-Llama-3-8B-Instruct" --prompt "Translate to French: Hello, how are you?" --max-tokens 50 --temperature 0.7
270
+ opengradient chat --model "mistralai/Mistral-7B-Instruct-v0.3" --messages-file messages.json --tools-file tools.json --max-tokens 200
228
271
  ```
229
272
 
230
273
  For more information read the OpenGradient [documentation](https://docs.opengradient.ai/).
@@ -1,4 +1,4 @@
1
- opengradient/__init__.py,sha256=P68cxSGs67Q11cuXiWywThnAweCiTImzw8o1pGrO46c,4015
1
+ opengradient/__init__.py,sha256=ATwimOCIZli1u5WKTMfhtH3VDeACqgK29BFAihyquvM,4015
2
2
  opengradient/account.py,sha256=2B7rtCXQDX-yF4U69h8B9-OUreJU4IqoGXG_1Hn9nWs,1150
3
3
  opengradient/cli.py,sha256=kdYR_AFKHV99HtO_son7vHpM5jWVZe8FO0iMWxJ7pJE,24444
4
4
  opengradient/client.py,sha256=RdlTz60NJKVJihYY6oVYLfNOg6RGnJbfG-2UIxUk-ws,37069
@@ -13,8 +13,8 @@ opengradient/proto/__init__.py,sha256=AhaSmrqV0TXGzCKaoPV8-XUvqs2fGAJBM2aOmDpkNb
13
13
  opengradient/proto/infer.proto,sha256=13eaEMcppxkBF8yChptsX9HooWFwJKze7oLZNl-LEb8,1217
14
14
  opengradient/proto/infer_pb2.py,sha256=wg2vjLQCNv6HRhYuIqgj9xivi3nO4IPz6E5wh2dhDqY,3446
15
15
  opengradient/proto/infer_pb2_grpc.py,sha256=y5GYwD1EdNs892xx58jdfyA0fO5QC7k3uZOtImTHMiE,6891
16
- opengradient-0.3.14.dist-info/METADATA,sha256=Ubgdi-3aaCIQtSPi5T553DRTWV_-x84WcJqZxcwMykY,7612
17
- opengradient-0.3.14.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
18
- opengradient-0.3.14.dist-info/entry_points.txt,sha256=yUKTaJx8RXnybkob0J62wVBiCp_1agVbgw9uzsmaeJc,54
19
- opengradient-0.3.14.dist-info/licenses/LICENSE,sha256=xEcvQ3AxZOtDkrqkys2Mm6Y9diEnaSeQRKvxi-JGnNA,1069
20
- opengradient-0.3.14.dist-info/RECORD,,
16
+ opengradient-0.3.15.dist-info/METADATA,sha256=j1LRy_faAg69fDQNEJhByO7kiPtd6jO-DQbNhDk99h0,8692
17
+ opengradient-0.3.15.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
18
+ opengradient-0.3.15.dist-info/entry_points.txt,sha256=yUKTaJx8RXnybkob0J62wVBiCp_1agVbgw9uzsmaeJc,54
19
+ opengradient-0.3.15.dist-info/licenses/LICENSE,sha256=xEcvQ3AxZOtDkrqkys2Mm6Y9diEnaSeQRKvxi-JGnNA,1069
20
+ opengradient-0.3.15.dist-info/RECORD,,