hjxdl 0.3.29__py3-none-any.whl → 0.3.30__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.
- hdl/_version.py +2 -2
- hdl/utils/llm/llm_wrapper.py +35 -0
- {hjxdl-0.3.29.dist-info → hjxdl-0.3.30.dist-info}/METADATA +1 -1
- {hjxdl-0.3.29.dist-info → hjxdl-0.3.30.dist-info}/RECORD +7 -7
- {hjxdl-0.3.29.dist-info → hjxdl-0.3.30.dist-info}/LICENSE +0 -0
- {hjxdl-0.3.29.dist-info → hjxdl-0.3.30.dist-info}/WHEEL +0 -0
- {hjxdl-0.3.29.dist-info → hjxdl-0.3.30.dist-info}/top_level.txt +0 -0
hdl/_version.py
CHANGED
hdl/utils/llm/llm_wrapper.py
CHANGED
@@ -56,6 +56,8 @@ class OpenAIWrapper(object):
|
|
56
56
|
*args,
|
57
57
|
**kwargs
|
58
58
|
)
|
59
|
+
if "client_type" not in conf:
|
60
|
+
conf["client_type"] = "chat"
|
59
61
|
|
60
62
|
def add_client(
|
61
63
|
self,
|
@@ -96,6 +98,7 @@ class OpenAIWrapper(object):
|
|
96
98
|
host = f"http://{host}:{port}/v1"
|
97
99
|
self.client_conf[client_id]['host'] = host
|
98
100
|
self.client_conf[client_id]['model'] = model
|
101
|
+
self.client_conf[client_id]['client_type'] = client_type
|
99
102
|
self.client_conf[client_id]['client'] = OpenAI(
|
100
103
|
base_url=host,
|
101
104
|
api_key=api_key,
|
@@ -347,3 +350,35 @@ class OpenAIWrapper(object):
|
|
347
350
|
return
|
348
351
|
|
349
352
|
return
|
353
|
+
|
354
|
+
def embedding(
|
355
|
+
self,
|
356
|
+
client_id: str,
|
357
|
+
texts: list[str],
|
358
|
+
model: str = None,
|
359
|
+
**kwargs
|
360
|
+
):
|
361
|
+
"""
|
362
|
+
Generates embeddings for a list of texts using a specified model.
|
363
|
+
|
364
|
+
Args:
|
365
|
+
client_id (str): The ID of the client to use for generating embeddings.
|
366
|
+
texts (list[str]): A list of texts for which to generate embeddings.
|
367
|
+
model (str, optional): The model to use for generating embeddings.
|
368
|
+
If not provided, the model specified in the client configuration will be used.
|
369
|
+
**kwargs: Additional keyword arguments to be passed to the client embedding creation method.
|
370
|
+
|
371
|
+
Returns:
|
372
|
+
list: A list of embeddings corresponding to the input texts.
|
373
|
+
"""
|
374
|
+
if not model:
|
375
|
+
model = self.client_conf[client_id]['model']
|
376
|
+
|
377
|
+
client = self.client_conf[client_id]['client']
|
378
|
+
response = client.embeddings.create(
|
379
|
+
input=texts,
|
380
|
+
model=model,
|
381
|
+
**kwargs
|
382
|
+
)
|
383
|
+
|
384
|
+
return [i.embedding for i in response.data]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
hdl/__init__.py,sha256=GffnD0jLJdhkd-vo989v40N90sQbofkayRBwxc6TVhQ,72
|
2
|
-
hdl/_version.py,sha256=
|
2
|
+
hdl/_version.py,sha256=rwxxREOGVMpe267h030C9wYX9mgJaCw7aCCw2Mw13-w,413
|
3
3
|
hdl/args/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
hdl/args/loss_args.py,sha256=s7YzSdd7IjD24rZvvOrxLLFqMZQb9YylxKeyelSdrTk,70
|
5
5
|
hdl/controllers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -136,15 +136,15 @@ hdl/utils/llm/chatgr.py,sha256=5F5PJHe8vz3iCfi4TT54DCLRi1UeJshECdVtgvvvao0,3696
|
|
136
136
|
hdl/utils/llm/embs.py,sha256=Tf0FOYrOFZp7qQpEPiSCXzlgyHH0X9HVTUtsup74a9E,7174
|
137
137
|
hdl/utils/llm/extract.py,sha256=2sK_WJzmYIc8iuWaM9DA6Nw3_6q1O4lJ5pKpcZo-bBA,6512
|
138
138
|
hdl/utils/llm/llama_chat.py,sha256=watcHGOaz-bv3x-yDucYlGk5f8FiqfFhwWogrl334fk,4387
|
139
|
-
hdl/utils/llm/llm_wrapper.py,sha256=
|
139
|
+
hdl/utils/llm/llm_wrapper.py,sha256=l5D2gWuxm_tpIoCeCfprXNh3hykFP3jMDaM6XCDKdew,14966
|
140
140
|
hdl/utils/llm/vis.py,sha256=SSP6tOwKLq0hWcpM3twI9TitqzBmKjlcGrnXEWYlCzM,26055
|
141
141
|
hdl/utils/llm/visrag.py,sha256=0i-VrxqgiV-J7R3VPshu9oc7-rKjFJOldYik3HDXj6M,10176
|
142
142
|
hdl/utils/schedulers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
143
143
|
hdl/utils/schedulers/norm_lr.py,sha256=bDwCmdEK-WkgxQMFBiMuchv8Mm7C0-GZJ6usm-PQk14,4461
|
144
144
|
hdl/utils/weather/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
145
145
|
hdl/utils/weather/weather.py,sha256=k11o6wM15kF8b9NMlEfrg68ak-SfSYLN3nOOflFUv-I,4381
|
146
|
-
hjxdl-0.3.
|
147
|
-
hjxdl-0.3.
|
148
|
-
hjxdl-0.3.
|
149
|
-
hjxdl-0.3.
|
150
|
-
hjxdl-0.3.
|
146
|
+
hjxdl-0.3.30.dist-info/LICENSE,sha256=lkMiSbeZHBQLB9LJEkS9-L3Z-LBC4yGnKrzHSG8RkPM,2599
|
147
|
+
hjxdl-0.3.30.dist-info/METADATA,sha256=tcWR37ej1V4kjTKf_ND9R9Yd7dpuRbbFjL3yZhwSzOQ,1336
|
148
|
+
hjxdl-0.3.30.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
149
|
+
hjxdl-0.3.30.dist-info/top_level.txt,sha256=-kxwTM5JPhylp06z3zAVO3w6_h7wtBfBo2zgM6YZoTk,4
|
150
|
+
hjxdl-0.3.30.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|