lollms-client 1.4.1__tar.gz → 1.4.6__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.
Potentially problematic release.
This version of lollms-client might be problematic. Click here for more details.
- {lollms_client-1.4.1/src/lollms_client.egg-info → lollms_client-1.4.6}/PKG-INFO +204 -2
- {lollms_client-1.4.1 → lollms_client-1.4.6}/pyproject.toml +3 -2
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/__init__.py +1 -1
- lollms_client-1.4.6/src/lollms_client/llm_bindings/novita_ai/__init__.py +303 -0
- lollms_client-1.4.6/src/lollms_client/llm_bindings/perplexity/__init__.py +326 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_discussion.py +11 -1
- lollms_client-1.4.6/src/lollms_client/tti_bindings/leonardo_ai/__init__.py +124 -0
- lollms_client-1.4.6/src/lollms_client/tti_bindings/novita_ai/__init__.py +102 -0
- lollms_client-1.4.6/src/lollms_client/tti_bindings/stability_ai/__init__.py +176 -0
- lollms_client-1.4.6/src/lollms_client/ttm_bindings/beatoven_ai/__init__.py +125 -0
- lollms_client-1.4.6/src/lollms_client/ttm_bindings/replicate/__init__.py +112 -0
- lollms_client-1.4.6/src/lollms_client/ttm_bindings/stability_ai/__init__.py +114 -0
- lollms_client-1.4.6/src/lollms_client/ttm_bindings/topmediai/__init__.py +93 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6/src/lollms_client.egg-info}/PKG-INFO +204 -2
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client.egg-info/SOURCES.txt +9 -1
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client.egg-info/requires.txt +1 -0
- lollms_client-1.4.1/src/lollms_client/ttm_bindings/bark/__init__.py +0 -339
- {lollms_client-1.4.1 → lollms_client-1.4.6}/LICENSE +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/README.md +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/setup.cfg +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/assets/models_ctx_sizes.json +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/azure_openai/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/claude/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/gemini/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/grok/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/groq/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/hugging_face_inference_api/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/litellm/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/llamacpp/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/lollms/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/lollms_webui/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/mistral/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/ollama/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/open_router/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/openai/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/openllm/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/pythonllamacpp/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/tensor_rt/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/transformers/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/llm_bindings/vllm/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_agentic.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_config.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_core.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_js_analyzer.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_llm_binding.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_mcp_binding.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_mcp_security.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_personality.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_python_analyzer.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_stt_binding.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_tti_binding.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_ttm_binding.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_tts_binding.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_ttv_binding.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_types.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/lollms_utilities.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/mcp_bindings/local_mcp/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/mcp_bindings/local_mcp/default_tools/file_writer/file_writer.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/mcp_bindings/local_mcp/default_tools/generate_image_from_prompt/generate_image_from_prompt.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/mcp_bindings/local_mcp/default_tools/internet_search/internet_search.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/mcp_bindings/local_mcp/default_tools/python_interpreter/python_interpreter.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/mcp_bindings/remote_mcp/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/mcp_bindings/standard_mcp/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/stt_bindings/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/stt_bindings/lollms/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/stt_bindings/whisper/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/stt_bindings/whispercpp/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tti_bindings/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tti_bindings/diffusers/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tti_bindings/gemini/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tti_bindings/lollms/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tti_bindings/openai/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/ttm_bindings/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/ttm_bindings/audiocraft/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/ttm_bindings/lollms/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tts_bindings/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tts_bindings/bark/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tts_bindings/bark/server/install_bark.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tts_bindings/bark/server/main.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tts_bindings/lollms/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tts_bindings/piper_tts/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tts_bindings/piper_tts/server/install_piper.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tts_bindings/piper_tts/server/main.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tts_bindings/piper_tts/server/setup_voices.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tts_bindings/xtts/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tts_bindings/xtts/server/main.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/tts_bindings/xtts/server/setup_voices.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/ttv_bindings/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client/ttv_bindings/lollms/__init__.py +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client.egg-info/dependency_links.txt +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/src/lollms_client.egg-info/top_level.txt +0 -0
- {lollms_client-1.4.1 → lollms_client-1.4.6}/test/test_lollms_discussion.py +0 -0
|
@@ -1,9 +1,210 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lollms_client
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.6
|
|
4
4
|
Summary: A client library for LoLLMs generate endpoint
|
|
5
5
|
Author-email: ParisNeo <parisneoai@gmail.com>
|
|
6
|
-
License:
|
|
6
|
+
License: Apache License
|
|
7
|
+
Version 2.0, January 2004
|
|
8
|
+
http://www.apache.org/licenses/
|
|
9
|
+
|
|
10
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
+
|
|
12
|
+
1. Definitions.
|
|
13
|
+
|
|
14
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
15
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
16
|
+
|
|
17
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
18
|
+
the copyright owner that is granting the License.
|
|
19
|
+
|
|
20
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
21
|
+
other entities that control, are controlled by, or are under common
|
|
22
|
+
control with that entity. For the purposes of this definition,
|
|
23
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
24
|
+
direction or management of such entity, whether by contract or
|
|
25
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
26
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
27
|
+
|
|
28
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
29
|
+
exercising permissions granted by this License.
|
|
30
|
+
|
|
31
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
32
|
+
including but not limited to software source code, documentation
|
|
33
|
+
source, and configuration files.
|
|
34
|
+
|
|
35
|
+
"Object" form shall mean any form resulting from mechanical
|
|
36
|
+
transformation or translation of a Source form, including but
|
|
37
|
+
not limited to compiled object code, generated documentation,
|
|
38
|
+
and conversions to other media types.
|
|
39
|
+
|
|
40
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
41
|
+
Object form, made available under the License, as indicated by a
|
|
42
|
+
copyright notice that is included in or attached to the work
|
|
43
|
+
(an example is provided in the Appendix below).
|
|
44
|
+
|
|
45
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
46
|
+
form, that is based on (or derived from) the Work and for which the
|
|
47
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
48
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
49
|
+
of this License, Derivative Works shall not include works that remain
|
|
50
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
51
|
+
the Work and Derivative Works thereof.
|
|
52
|
+
|
|
53
|
+
"Contribution" shall mean any work of authorship, including
|
|
54
|
+
the original version of the Work and any modifications or additions
|
|
55
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
56
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
57
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
58
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
59
|
+
means any form of electronic, verbal, or written communication sent
|
|
60
|
+
to the Licensor or its representatives, including but not limited to
|
|
61
|
+
communication on electronic mailing lists, source code control systems,
|
|
62
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
63
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
64
|
+
excluding communication that is conspicuously marked or otherwise
|
|
65
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
66
|
+
|
|
67
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
68
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
69
|
+
subsequently incorporated within the Work.
|
|
70
|
+
|
|
71
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
72
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
73
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
74
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
75
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
76
|
+
Work and such Derivative Works in Source or Object form.
|
|
77
|
+
|
|
78
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
79
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
80
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
81
|
+
(except as stated in this section) patent license to make, have made,
|
|
82
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
83
|
+
where such license applies only to those patent claims licensable
|
|
84
|
+
by such Contributor that are necessarily infringed by their
|
|
85
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
86
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
87
|
+
institute patent litigation against any entity (including a
|
|
88
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
89
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
90
|
+
or contributory patent infringement, then any patent licenses
|
|
91
|
+
granted to You under this License for that Work shall terminate
|
|
92
|
+
as of the date such litigation is filed.
|
|
93
|
+
|
|
94
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
95
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
96
|
+
modifications, and in Source or Object form, provided that You
|
|
97
|
+
meet the following conditions:
|
|
98
|
+
|
|
99
|
+
(a) You must give any other recipients of the Work or
|
|
100
|
+
Derivative Works a copy of this License; and
|
|
101
|
+
|
|
102
|
+
(b) You must cause any modified files to carry prominent notices
|
|
103
|
+
stating that You changed the files; and
|
|
104
|
+
|
|
105
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
106
|
+
that You distribute, all copyright, patent, trademark, and
|
|
107
|
+
attribution notices from the Source form of the Work,
|
|
108
|
+
excluding those notices that do not pertain to any part of
|
|
109
|
+
the Derivative Works; and
|
|
110
|
+
|
|
111
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
112
|
+
distribution, then any Derivative Works that You distribute must
|
|
113
|
+
include a readable copy of the attribution notices contained
|
|
114
|
+
within such NOTICE file, excluding those notices that do not
|
|
115
|
+
pertain to any part of the Derivative Works, in at least one
|
|
116
|
+
of the following places: within a NOTICE text file distributed
|
|
117
|
+
as part of the Derivative Works; within the Source form or
|
|
118
|
+
documentation, if provided along with the Derivative Works; or,
|
|
119
|
+
within a display generated by the Derivative Works, if and
|
|
120
|
+
wherever such third-party notices normally appear. The contents
|
|
121
|
+
of the NOTICE file are for informational purposes only and
|
|
122
|
+
do not modify the License. You may add Your own attribution
|
|
123
|
+
notices within Derivative Works that You distribute, alongside
|
|
124
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
125
|
+
that such additional attribution notices cannot be construed
|
|
126
|
+
as modifying the License.
|
|
127
|
+
|
|
128
|
+
You may add Your own copyright statement to Your modifications and
|
|
129
|
+
may provide additional or different license terms and conditions
|
|
130
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
131
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
132
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
133
|
+
the conditions stated in this License.
|
|
134
|
+
|
|
135
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
136
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
137
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
138
|
+
this License, without any additional terms or conditions.
|
|
139
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
140
|
+
the terms of any separate license agreement you may have executed
|
|
141
|
+
with Licensor regarding such Contributions.
|
|
142
|
+
|
|
143
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
144
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
145
|
+
except as required for reasonable and customary use in describing the
|
|
146
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
147
|
+
|
|
148
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
149
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
150
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
151
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
152
|
+
implied, including, without limitation, any warranties or conditions
|
|
153
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
154
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
155
|
+
appropriateness of using or redistributing the Work and assume any
|
|
156
|
+
risks associated with Your exercise of permissions under this License.
|
|
157
|
+
|
|
158
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
159
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
160
|
+
unless required by applicable law (such as deliberate and grossly
|
|
161
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
162
|
+
liable to You for damages, including any direct, indirect, special,
|
|
163
|
+
incidental, or consequential damages of any character arising as a
|
|
164
|
+
result of this License or out of the use or inability to use the
|
|
165
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
166
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
167
|
+
other commercial damages or losses), even if such Contributor
|
|
168
|
+
has been advised of the possibility of such damages.
|
|
169
|
+
|
|
170
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
171
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
172
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
173
|
+
or other liability obligations and/or rights consistent with this
|
|
174
|
+
License. However, in accepting such obligations, You may act only
|
|
175
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
176
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
177
|
+
defend, and hold each Contributor harmless for any liability
|
|
178
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
179
|
+
of your accepting any such warranty or additional liability.
|
|
180
|
+
|
|
181
|
+
END OF TERMS AND CONDITIONS
|
|
182
|
+
|
|
183
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
184
|
+
|
|
185
|
+
To apply the Apache License to your work, attach the following
|
|
186
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
187
|
+
replaced with your own identifying information. (Don't include
|
|
188
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
189
|
+
comment syntax for the file format. We also recommend that a
|
|
190
|
+
file or class name and description of purpose be included on the
|
|
191
|
+
same "printed page" as the copyright notice for easier
|
|
192
|
+
identification within third-party archives.
|
|
193
|
+
|
|
194
|
+
Copyright [yyyy] [name of copyright owner]
|
|
195
|
+
|
|
196
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
197
|
+
you may not use this file except in compliance with the License.
|
|
198
|
+
You may obtain a copy of the License at
|
|
199
|
+
|
|
200
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
201
|
+
|
|
202
|
+
Unless required by applicable law or agreed to in writing, software
|
|
203
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
204
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
205
|
+
See the License for the specific language governing permissions and
|
|
206
|
+
limitations under the License.
|
|
207
|
+
|
|
7
208
|
Project-URL: Homepage, https://github.com/ParisNeo/lollms_client
|
|
8
209
|
Classifier: Programming Language :: Python :: 3
|
|
9
210
|
Classifier: Programming Language :: Python :: 3.8
|
|
@@ -18,6 +219,7 @@ Classifier: Intended Audience :: Science/Research
|
|
|
18
219
|
Requires-Python: >=3.7
|
|
19
220
|
Description-Content-Type: text/markdown
|
|
20
221
|
License-File: LICENSE
|
|
222
|
+
Requires-Dist: httpx
|
|
21
223
|
Requires-Dist: requests
|
|
22
224
|
Requires-Dist: ascii-colors
|
|
23
225
|
Requires-Dist: pipmaster
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=80.9", "wheel"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
# REMOVE THE LINE BELOW:
|
|
5
5
|
# backend-path = ["."]
|
|
@@ -13,7 +13,7 @@ authors = [
|
|
|
13
13
|
description = "A client library for LoLLMs generate endpoint"
|
|
14
14
|
readme = "README.md"
|
|
15
15
|
requires-python = ">=3.7"
|
|
16
|
-
license = {
|
|
16
|
+
license = { file = "LICENSE" }
|
|
17
17
|
classifiers = [
|
|
18
18
|
"Programming Language :: Python :: 3",
|
|
19
19
|
"Programming Language :: Python :: 3.8",
|
|
@@ -27,6 +27,7 @@ classifiers = [
|
|
|
27
27
|
"Intended Audience :: Science/Research",
|
|
28
28
|
]
|
|
29
29
|
dependencies = [
|
|
30
|
+
"httpx",
|
|
30
31
|
"requests",
|
|
31
32
|
"ascii-colors",
|
|
32
33
|
"pipmaster",
|
|
@@ -8,7 +8,7 @@ from lollms_client.lollms_utilities import PromptReshaper # Keep general utiliti
|
|
|
8
8
|
from lollms_client.lollms_mcp_binding import LollmsMCPBinding, LollmsMCPBindingManager
|
|
9
9
|
from lollms_client.lollms_llm_binding import LollmsLLMBindingManager
|
|
10
10
|
|
|
11
|
-
__version__ = "1.4.
|
|
11
|
+
__version__ = "1.4.6" # Updated version
|
|
12
12
|
|
|
13
13
|
# Optionally, you could define __all__ if you want to be explicit about exports
|
|
14
14
|
__all__ = [
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import json
|
|
3
|
+
import requests
|
|
4
|
+
from typing import Optional, Callable, List, Union, Dict
|
|
5
|
+
|
|
6
|
+
from lollms_client.lollms_discussion import LollmsDiscussion, LollmsMessage
|
|
7
|
+
from lollms_client.lollms_llm_binding import LollmsLLMBinding
|
|
8
|
+
from lollms_client.lollms_types import MSG_TYPE
|
|
9
|
+
from ascii_colors import ASCIIColors, trace_exception
|
|
10
|
+
|
|
11
|
+
import pipmaster as pm
|
|
12
|
+
|
|
13
|
+
# Ensure the required packages are installed
|
|
14
|
+
pm.ensure_packages(["requests", "tiktoken"])
|
|
15
|
+
|
|
16
|
+
import tiktoken
|
|
17
|
+
|
|
18
|
+
BindingName = "NovitaAIBinding"
|
|
19
|
+
API_BASE_URL = "https://api.novita.ai"
|
|
20
|
+
|
|
21
|
+
# A hardcoded list of models based on Novita AI's documentation.
|
|
22
|
+
# The API is OpenAI-compatible but does not provide a models listing endpoint.
|
|
23
|
+
# Sourced from: https://docs.novita.ai/language-model/models
|
|
24
|
+
_FALLBACK_MODELS = [
|
|
25
|
+
{'model_name': 'meta-llama/Llama-3-8B-Instruct', 'display_name': 'Llama 3 8B Instruct', 'description': 'Meta\'s Llama 3 8B instruction-tuned model.', 'owned_by': 'Meta'},
|
|
26
|
+
{'model_name': 'meta-llama/Llama-3-70B-Instruct', 'display_name': 'Llama 3 70B Instruct', 'description': 'Meta\'s Llama 3 70B instruction-tuned model.', 'owned_by': 'Meta'},
|
|
27
|
+
{'model_name': 'mistralai/Mixtral-8x7B-Instruct-v0.1', 'display_name': 'Mixtral 8x7B Instruct', 'description': 'Mistral AI\'s Mixtral 8x7B instruction-tuned model.', 'owned_by': 'Mistral AI'},
|
|
28
|
+
{'model_name': 'mistralai/Mistral-7B-Instruct-v0.2', 'display_name': 'Mistral 7B Instruct v0.2', 'description': 'Mistral AI\'s 7B instruction-tuned model.', 'owned_by': 'Mistral AI'},
|
|
29
|
+
{'model_name': 'google/gemma-7b-it', 'display_name': 'Gemma 7B IT', 'description': 'Google\'s Gemma 7B instruction-tuned model.', 'owned_by': 'Google'},
|
|
30
|
+
{'model_name': 'google/gemma-2-9b-it', 'display_name': 'Gemma 2 9B IT', 'description': 'Google\'s next-generation Gemma 2 9B instruction-tuned model.', 'owned_by': 'Google'},
|
|
31
|
+
{'model_name': 'deepseek-ai/deepseek-coder-33b-instruct', 'display_name': 'Deepseek Coder 33B Instruct', 'description': 'A powerful coding model from Deepseek AI.', 'owned_by': 'Deepseek AI'},
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
class NovitaAIBinding(LollmsLLMBinding):
|
|
35
|
+
"""Novita AI-specific binding implementation using their OpenAI-compatible API."""
|
|
36
|
+
|
|
37
|
+
def __init__(self, **kwargs):
|
|
38
|
+
"""
|
|
39
|
+
Initialize the Novita AI binding.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
model_name (str): Name of the Novita AI model to use.
|
|
43
|
+
service_key (str): Novita AI API key.
|
|
44
|
+
"""
|
|
45
|
+
super().__init__(BindingName, **kwargs)
|
|
46
|
+
self.model_name = kwargs.get("model_name")
|
|
47
|
+
self.service_key = kwargs.get("service_key")
|
|
48
|
+
|
|
49
|
+
if not self.service_key:
|
|
50
|
+
self.service_key = os.getenv("NOVITA_API_KEY")
|
|
51
|
+
|
|
52
|
+
if not self.service_key:
|
|
53
|
+
raise ValueError("Novita AI API key is required. Please set it via the 'service_key' parameter or the NOVITA_API_KEY environment variable.")
|
|
54
|
+
|
|
55
|
+
self.headers = {
|
|
56
|
+
"Authorization": f"Bearer {self.service_key}",
|
|
57
|
+
"Content-Type": "application/json",
|
|
58
|
+
"Accept": "application/json"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
def _construct_parameters(self,
|
|
62
|
+
temperature: float,
|
|
63
|
+
top_p: float,
|
|
64
|
+
n_predict: int,
|
|
65
|
+
presence_penalty: float,
|
|
66
|
+
frequency_penalty: float) -> Dict[str, any]:
|
|
67
|
+
"""Builds a parameters dictionary for the Novita AI API."""
|
|
68
|
+
params = {}
|
|
69
|
+
if temperature is not None: params['temperature'] = float(temperature)
|
|
70
|
+
if top_p is not None: params['top_p'] = top_p
|
|
71
|
+
if n_predict is not None: params['max_tokens'] = n_predict
|
|
72
|
+
if presence_penalty is not None: params['presence_penalty'] = presence_penalty
|
|
73
|
+
if frequency_penalty is not None: params['frequency_penalty'] = frequency_penalty
|
|
74
|
+
return params
|
|
75
|
+
|
|
76
|
+
def chat(self,
|
|
77
|
+
discussion: LollmsDiscussion,
|
|
78
|
+
branch_tip_id: Optional[str] = None,
|
|
79
|
+
n_predict: Optional[int] = 2048,
|
|
80
|
+
stream: Optional[bool] = False,
|
|
81
|
+
temperature: float = 0.7,
|
|
82
|
+
top_k: int = 50, # Not supported by Novita API
|
|
83
|
+
top_p: float = 0.9,
|
|
84
|
+
repeat_penalty: float = 1.1, # maps to frequency_penalty
|
|
85
|
+
presence_penalty: Optional[float] = 0.0,
|
|
86
|
+
seed: Optional[int] = None, # Not supported
|
|
87
|
+
n_threads: Optional[int] = None, # Not applicable
|
|
88
|
+
ctx_size: Optional[int] = None, # Determined by model
|
|
89
|
+
streaming_callback: Optional[Callable[[str, MSG_TYPE], None]] = None
|
|
90
|
+
) -> Union[str, dict]:
|
|
91
|
+
"""
|
|
92
|
+
Conduct a chat session with a Novita AI model using a LollmsDiscussion object.
|
|
93
|
+
"""
|
|
94
|
+
system_prompt = discussion.system_prompt
|
|
95
|
+
messages = discussion.get_messages(branch_tip_id)
|
|
96
|
+
|
|
97
|
+
history = []
|
|
98
|
+
if system_prompt and system_prompt.strip():
|
|
99
|
+
history.append({"role": "system", "content": system_prompt})
|
|
100
|
+
|
|
101
|
+
for msg in messages:
|
|
102
|
+
role = 'user' if msg.sender_type == "user" else 'assistant'
|
|
103
|
+
|
|
104
|
+
if msg.images:
|
|
105
|
+
ASCIIColors.warning("Novita AI API does not support images. They will be ignored.")
|
|
106
|
+
|
|
107
|
+
if msg.content and msg.content.strip():
|
|
108
|
+
history.append({"role": role, "content": msg.content})
|
|
109
|
+
|
|
110
|
+
if not history:
|
|
111
|
+
return {"status": "error", "message": "Cannot start chat with an empty discussion."}
|
|
112
|
+
|
|
113
|
+
api_params = self._construct_parameters(
|
|
114
|
+
temperature, top_p, n_predict, presence_penalty, repeat_penalty
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
payload = {
|
|
118
|
+
"model": self.model_name,
|
|
119
|
+
"messages": history,
|
|
120
|
+
"stream": stream,
|
|
121
|
+
**api_params
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
url = f"{API_BASE_URL}/v1/chat/completions"
|
|
125
|
+
full_response_text = ""
|
|
126
|
+
|
|
127
|
+
try:
|
|
128
|
+
if stream:
|
|
129
|
+
with requests.post(url, headers=self.headers, json=payload, stream=True) as response:
|
|
130
|
+
response.raise_for_status()
|
|
131
|
+
for line in response.iter_lines():
|
|
132
|
+
if line:
|
|
133
|
+
decoded_line = line.decode('utf-8')
|
|
134
|
+
if decoded_line.startswith("data:"):
|
|
135
|
+
content = decoded_line[len("data: "):].strip()
|
|
136
|
+
if content == "[DONE]":
|
|
137
|
+
break
|
|
138
|
+
try:
|
|
139
|
+
chunk = json.loads(content)
|
|
140
|
+
delta = chunk.get("choices", [{}])[0].get("delta", {})
|
|
141
|
+
text_chunk = delta.get("content", "")
|
|
142
|
+
if text_chunk:
|
|
143
|
+
full_response_text += text_chunk
|
|
144
|
+
if streaming_callback:
|
|
145
|
+
if not streaming_callback(text_chunk, MSG_TYPE.MSG_TYPE_CHUNK):
|
|
146
|
+
break
|
|
147
|
+
except json.JSONDecodeError:
|
|
148
|
+
ASCIIColors.error(f"Failed to decode JSON chunk: {content}")
|
|
149
|
+
continue
|
|
150
|
+
return full_response_text
|
|
151
|
+
else:
|
|
152
|
+
response = requests.post(url, headers=self.headers, json=payload)
|
|
153
|
+
response.raise_for_status()
|
|
154
|
+
data = response.json()
|
|
155
|
+
return data["choices"][0]["message"]["content"]
|
|
156
|
+
except requests.exceptions.HTTPError as e:
|
|
157
|
+
try:
|
|
158
|
+
error_details = e.response.json()
|
|
159
|
+
error_message = error_details.get("error", {}).get("message", e.response.text)
|
|
160
|
+
except json.JSONDecodeError:
|
|
161
|
+
error_message = e.response.text
|
|
162
|
+
ASCIIColors.error(f"HTTP Error received from Novita AI API: {e.response.status_code} - {error_message}")
|
|
163
|
+
return {"status": "error", "message": f"HTTP Error: {e.response.status_code} - {error_message}"}
|
|
164
|
+
except requests.exceptions.RequestException as e:
|
|
165
|
+
error_message = f"An error occurred with the Novita AI API: {e}"
|
|
166
|
+
trace_exception(e)
|
|
167
|
+
return {"status": "error", "message": str(e)}
|
|
168
|
+
|
|
169
|
+
def tokenize(self, text: str) -> list:
|
|
170
|
+
"""
|
|
171
|
+
Tokenize the input text. Novita uses an OpenAI-compatible API,
|
|
172
|
+
so we use the same tokenizer as GPT-4.
|
|
173
|
+
"""
|
|
174
|
+
try:
|
|
175
|
+
encoding = tiktoken.get_encoding("cl100k_base")
|
|
176
|
+
return encoding.encode(text)
|
|
177
|
+
except Exception as e:
|
|
178
|
+
ASCIIColors.error(f"Could not use tiktoken, falling back to simple encoding: {e}")
|
|
179
|
+
return list(text.encode('utf-8'))
|
|
180
|
+
|
|
181
|
+
def detokenize(self, tokens: list) -> str:
|
|
182
|
+
"""
|
|
183
|
+
Detokenize a list of tokens.
|
|
184
|
+
"""
|
|
185
|
+
try:
|
|
186
|
+
encoding = tiktoken.get_encoding("cl100k_base")
|
|
187
|
+
return encoding.decode(tokens)
|
|
188
|
+
except Exception as e:
|
|
189
|
+
ASCIIColors.error(f"Could not use tiktoken, falling back to simple decoding: {e}")
|
|
190
|
+
return bytes(tokens).decode('utf-8', errors='ignore')
|
|
191
|
+
|
|
192
|
+
def count_tokens(self, text: str) -> int:
|
|
193
|
+
"""
|
|
194
|
+
Count tokens from a text.
|
|
195
|
+
"""
|
|
196
|
+
return len(self.tokenize(text))
|
|
197
|
+
|
|
198
|
+
def embed(self, text: str, **kwargs) -> List[float]:
|
|
199
|
+
"""
|
|
200
|
+
Get embeddings for the input text.
|
|
201
|
+
"""
|
|
202
|
+
ASCIIColors.warning("Novita AI does not offer a public embedding API via this binding. This method is not implemented.")
|
|
203
|
+
raise NotImplementedError("Novita AI binding does not support embeddings.")
|
|
204
|
+
|
|
205
|
+
def get_model_info(self) -> dict:
|
|
206
|
+
"""Return information about the current model setup."""
|
|
207
|
+
return {
|
|
208
|
+
"name": self.binding_name,
|
|
209
|
+
"host_address": API_BASE_URL,
|
|
210
|
+
"model_name": self.model_name,
|
|
211
|
+
"supports_vision": False
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
def listModels(self) -> List[Dict[str, str]]:
|
|
215
|
+
"""
|
|
216
|
+
Lists available models. Novita AI API does not have a models endpoint,
|
|
217
|
+
so a hardcoded list from their documentation is returned.
|
|
218
|
+
"""
|
|
219
|
+
return sorted(_FALLBACK_MODELS, key=lambda x: x['display_name'])
|
|
220
|
+
|
|
221
|
+
def load_model(self, model_name: str) -> bool:
|
|
222
|
+
"""Set the model name for subsequent operations."""
|
|
223
|
+
self.model_name = model_name
|
|
224
|
+
ASCIIColors.info(f"Novita AI model set to: {model_name}.")
|
|
225
|
+
return True
|
|
226
|
+
|
|
227
|
+
if __name__ == '__main__':
|
|
228
|
+
if 'NOVITA_API_KEY' not in os.environ:
|
|
229
|
+
ASCIIColors.red("Error: NOVITA_API_KEY environment variable not set.")
|
|
230
|
+
print("Please get your key from novita.ai and set it.")
|
|
231
|
+
exit(1)
|
|
232
|
+
|
|
233
|
+
ASCIIColors.yellow("--- Testing NovitaAIBinding ---")
|
|
234
|
+
|
|
235
|
+
test_model_name = "meta-llama/Llama-3-8B-Instruct"
|
|
236
|
+
|
|
237
|
+
try:
|
|
238
|
+
# --- Initialization ---
|
|
239
|
+
ASCIIColors.cyan("\n--- Initializing Binding ---")
|
|
240
|
+
binding = NovitaAIBinding(model_name=test_model_name)
|
|
241
|
+
ASCIIColors.green("Binding initialized successfully.")
|
|
242
|
+
|
|
243
|
+
# --- List Models ---
|
|
244
|
+
ASCIIColors.cyan("\n--- Listing Models (static list) ---")
|
|
245
|
+
models = binding.listModels()
|
|
246
|
+
if models:
|
|
247
|
+
ASCIIColors.green(f"Found {len(models)} models.")
|
|
248
|
+
for m in models:
|
|
249
|
+
print(f"- {m['model_name']} ({m['display_name']})")
|
|
250
|
+
else:
|
|
251
|
+
ASCIIColors.error("Failed to list models.")
|
|
252
|
+
|
|
253
|
+
# --- Count Tokens ---
|
|
254
|
+
ASCIIColors.cyan("\n--- Counting Tokens ---")
|
|
255
|
+
sample_text = "Hello, world! This is a test."
|
|
256
|
+
token_count = binding.count_tokens(sample_text)
|
|
257
|
+
ASCIIColors.green(f"Token count for '{sample_text}': {token_count}")
|
|
258
|
+
|
|
259
|
+
# --- Chat (Non-Streaming) ---
|
|
260
|
+
ASCIIColors.cyan("\n--- Chat (Non-Streaming) ---")
|
|
261
|
+
discussion_non_stream = LollmsDiscussion.from_messages(
|
|
262
|
+
messages=[
|
|
263
|
+
{"sender":"user", "content": "What is the largest planet in our solar system?"}
|
|
264
|
+
],
|
|
265
|
+
system_prompt="You are a helpful and concise astronomical assistant."
|
|
266
|
+
)
|
|
267
|
+
ASCIIColors.info(f"Prompt: What is the largest planet in our solar system?")
|
|
268
|
+
generated_text = binding.chat(discussion_non_stream, n_predict=50, stream=False)
|
|
269
|
+
if isinstance(generated_text, str):
|
|
270
|
+
ASCIIColors.green(f"Generated text:\n{generated_text}")
|
|
271
|
+
else:
|
|
272
|
+
ASCIIColors.error(f"Generation failed: {generated_text}")
|
|
273
|
+
|
|
274
|
+
# --- Chat (Streaming) ---
|
|
275
|
+
ASCIIColors.cyan("\n--- Chat (Streaming) ---")
|
|
276
|
+
|
|
277
|
+
captured_chunks = []
|
|
278
|
+
def stream_callback(chunk: str, msg_type: int):
|
|
279
|
+
ASCIIColors.green(chunk, end="", flush=True)
|
|
280
|
+
captured_chunks.append(chunk)
|
|
281
|
+
return True
|
|
282
|
+
|
|
283
|
+
discussion_stream = LollmsDiscussion.from_messages(
|
|
284
|
+
messages=[
|
|
285
|
+
{"sender":"user", "content": "Explain the concept of photosynthesis in one short paragraph."}
|
|
286
|
+
]
|
|
287
|
+
)
|
|
288
|
+
ASCIIColors.info(f"Prompt: Explain the concept of photosynthesis in one short paragraph.")
|
|
289
|
+
result = binding.chat(
|
|
290
|
+
discussion_stream,
|
|
291
|
+
n_predict=150,
|
|
292
|
+
stream=True,
|
|
293
|
+
streaming_callback=stream_callback
|
|
294
|
+
)
|
|
295
|
+
print("\n--- End of Stream ---")
|
|
296
|
+
full_streamed_text = "".join(captured_chunks)
|
|
297
|
+
assert result == full_streamed_text
|
|
298
|
+
|
|
299
|
+
except Exception as e:
|
|
300
|
+
ASCIIColors.error(f"An error occurred during testing: {e}")
|
|
301
|
+
trace_exception(e)
|
|
302
|
+
|
|
303
|
+
ASCIIColors.yellow("\nNovitaAIBinding test finished.")
|