llm-ie 0.1.1__py3-none-any.whl → 0.1.2__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.
llm_ie/engines.py
CHANGED
|
@@ -31,7 +31,6 @@ class InferenceEngine:
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
class LlamaCppInferenceEngine(InferenceEngine):
|
|
34
|
-
from llama_cpp import Llama
|
|
35
34
|
def __init__(self, repo_id:str, gguf_filename:str, n_ctx:int=4096, n_gpu_layers:int=-1, **kwrs):
|
|
36
35
|
"""
|
|
37
36
|
The Llama.cpp inference engine.
|
|
@@ -48,13 +47,13 @@ class LlamaCppInferenceEngine(InferenceEngine):
|
|
|
48
47
|
n_gpu_layers : int, Optional
|
|
49
48
|
number of layers to offload to GPU. Default is all layers (-1).
|
|
50
49
|
"""
|
|
51
|
-
|
|
50
|
+
from llama_cpp import Llama
|
|
52
51
|
self.repo_id = repo_id
|
|
53
52
|
self.gguf_filename = gguf_filename
|
|
54
53
|
self.n_ctx = n_ctx
|
|
55
54
|
self.n_gpu_layers = n_gpu_layers
|
|
56
55
|
|
|
57
|
-
self.model =
|
|
56
|
+
self.model = Llama.from_pretrained(
|
|
58
57
|
repo_id=self.repo_id,
|
|
59
58
|
filename=self.gguf_filename,
|
|
60
59
|
n_gpu_layers=n_gpu_layers,
|
|
@@ -106,7 +105,6 @@ class LlamaCppInferenceEngine(InferenceEngine):
|
|
|
106
105
|
|
|
107
106
|
|
|
108
107
|
class OllamaInferenceEngine(InferenceEngine):
|
|
109
|
-
import ollama
|
|
110
108
|
def __init__(self, model_name:str, num_ctx:int=4096, keep_alive:int=300, **kwrs):
|
|
111
109
|
"""
|
|
112
110
|
The Ollama inference engine.
|
|
@@ -120,6 +118,8 @@ class OllamaInferenceEngine(InferenceEngine):
|
|
|
120
118
|
keep_alive : int, Optional
|
|
121
119
|
seconds to hold the LLM after the last API call.
|
|
122
120
|
"""
|
|
121
|
+
import ollama
|
|
122
|
+
self.ollama = ollama
|
|
123
123
|
self.model_name = model_name
|
|
124
124
|
self.num_ctx = num_ctx
|
|
125
125
|
self.keep_alive = keep_alive
|
|
@@ -158,13 +158,13 @@ class OllamaInferenceEngine(InferenceEngine):
|
|
|
158
158
|
|
|
159
159
|
|
|
160
160
|
class HuggingFaceHubInferenceEngine(InferenceEngine):
|
|
161
|
-
from huggingface_hub import InferenceClient
|
|
162
161
|
def __init__(self, **kwrs):
|
|
163
162
|
"""
|
|
164
163
|
The Huggingface_hub InferenceClient inference engine.
|
|
165
164
|
For parameters and documentation, refer to https://huggingface.co/docs/huggingface_hub/en/package_reference/inference_client
|
|
166
165
|
"""
|
|
167
|
-
|
|
166
|
+
from huggingface_hub import InferenceClient
|
|
167
|
+
self.client = InferenceClient(**kwrs)
|
|
168
168
|
|
|
169
169
|
def chat(self, messages:List[Dict[str,str]], max_new_tokens:int=2048, temperature:float=0.0, stream:bool=False, **kwrs) -> str:
|
|
170
170
|
"""
|
|
@@ -200,7 +200,6 @@ class HuggingFaceHubInferenceEngine(InferenceEngine):
|
|
|
200
200
|
|
|
201
201
|
|
|
202
202
|
class OpenAIInferenceEngine(InferenceEngine):
|
|
203
|
-
from openai import OpenAI
|
|
204
203
|
def __init__(self, model:str, **kwrs):
|
|
205
204
|
"""
|
|
206
205
|
The OpenAI API inference engine.
|
|
@@ -211,7 +210,8 @@ class OpenAIInferenceEngine(InferenceEngine):
|
|
|
211
210
|
model_name : str
|
|
212
211
|
model name as described in https://platform.openai.com/docs/models
|
|
213
212
|
"""
|
|
214
|
-
|
|
213
|
+
from openai import OpenAI
|
|
214
|
+
self.client = OpenAI(**kwrs)
|
|
215
215
|
self.model = model
|
|
216
216
|
|
|
217
217
|
def chat(self, messages:List[Dict[str,str]], max_new_tokens:int=2048, temperature:float=0.0, stream:bool=False, **kwrs) -> str:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
llm_ie/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
llm_ie/data_types.py,sha256=AxqgfmPkYySDz7VuTWh8yDWofvZgdjgFiW9hihqInHc,6605
|
|
3
|
-
llm_ie/engines.py,sha256=
|
|
3
|
+
llm_ie/engines.py,sha256=TuxM56_u6-dsAAuNdfuKSH23nb9UfFbg6T60e-OXEA8,9294
|
|
4
4
|
llm_ie/extractors.py,sha256=94uPhEtpYeingMY4WVLc8F6vw8hnSS8Wt-TMr5B5flg,22315
|
|
5
5
|
llm_ie/prompt_editor.py,sha256=doPjy5HFoZvP5Y1x_rcA_-wSQfqHkwKfETQd3uIh0GA,1212
|
|
6
|
-
llm_ie-0.1.
|
|
7
|
-
llm_ie-0.1.
|
|
8
|
-
llm_ie-0.1.
|
|
6
|
+
llm_ie-0.1.2.dist-info/METADATA,sha256=74HgMLENRFNbx04Vgk0uLbrKOQkxfAM6ZXOk75gbSO0,27975
|
|
7
|
+
llm_ie-0.1.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
8
|
+
llm_ie-0.1.2.dist-info/RECORD,,
|
|
File without changes
|