pygpt-net 2.6.24__py3-none-any.whl → 2.6.25__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.
pygpt_net/CHANGELOG.txt CHANGED
@@ -1,3 +1,9 @@
1
+ 2.6.25 (2025-08-26)
2
+
3
+ - Fixed the empty agent ID issue in OpenAI Agents evaluation.
4
+ - Added the ability to select a custom model for evaluation.
5
+ - Added embedding providers: Anthropic, Deepseek, MistralAI, xAI, VoyageAI.
6
+
1
7
  2.6.24 (2025-08-26)
2
8
 
3
9
  - Added a new option: LlamaIndex -> Embeddings -> Default embedding providers for attachments.
pygpt_net/__init__.py CHANGED
@@ -13,7 +13,7 @@ __author__ = "Marcin Szczygliński"
13
13
  __copyright__ = "Copyright 2025, Marcin Szczygliński"
14
14
  __credits__ = ["Marcin Szczygliński"]
15
15
  __license__ = "MIT"
16
- __version__ = "2.6.24"
16
+ __version__ = "2.6.25"
17
17
  __build__ = "2025-08-26"
18
18
  __maintainer__ = "Marcin Szczygliński"
19
19
  __github__ = "https://github.com/szczyglis-dev/py-gpt"
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.08.15 23:00:00 #
9
+ # Updated Date: 2025.08.26 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Dict, Any, List
@@ -337,6 +337,8 @@ class Placeholder:
337
337
  items[mid] = model.name
338
338
 
339
339
  data: List[Dict[str, str]] = []
340
+ if "allow_empty" in params and params["allow_empty"] is True:
341
+ data.append({'_': '---'})
340
342
  providers = self.window.core.llm.get_choices()
341
343
  if not providers:
342
344
  for mid, name in sorted(items.items(), key=lambda kv: kv[1].lower()):
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.08.24 23:00:00 #
9
+ # Updated Date: 2025.08.26 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import copy
@@ -391,7 +391,7 @@ class Importer:
391
391
  'type': 'str'
392
392
  }
393
393
  ]
394
- elif self.provider == "openai":
394
+ elif self.provider in ["openai", "azure_openai"]:
395
395
  m.tool_calls = True
396
396
  m.llama_index['env'] = [
397
397
  {
@@ -429,12 +429,35 @@ class Importer:
429
429
  'type': 'str'
430
430
  }
431
431
  ]
432
+ elif self.provider == "mistral_ai":
433
+ m.tool_calls = True
434
+ m.llama_index['args'] = [
435
+ {
436
+ 'name': 'api_key',
437
+ 'value': '{api_key_mistral}',
438
+ 'type': 'str'
439
+ }
440
+ ]
441
+ elif self.provider == "local_ai":
442
+ m.tool_calls = True
443
+ m.llama_index['env'] = [
444
+ {
445
+ 'name': 'OPENAI_API_KEY',
446
+ 'value': '{api_key}',
447
+ 'type': 'str'
448
+ },
449
+ {
450
+ 'name': 'OPENAI_API_BASE',
451
+ 'value': '{api_endpoint}',
452
+ 'type': 'str'
453
+ }
454
+ ]
432
455
  elif self.provider == "x_ai":
433
456
  m.tool_calls = True
434
457
  m.llama_index['env'] = [
435
458
  {
436
459
  'name': 'OPENAI_API_KEY',
437
- 'value': '{api_key_xai',
460
+ 'value': '{api_key_xai}',
438
461
  'type': 'str'
439
462
  },
440
463
  {
@@ -587,9 +610,9 @@ class Importer:
587
610
  :return: Dict with keys and values
588
611
  """
589
612
  excluded = [
590
- "azure_openai",
613
+ #"azure_openai",
591
614
  "huggingface_api",
592
- "mistral_ai",
615
+ #"mistral_ai",
593
616
  "local_ai",
594
617
  "perplexity",
595
618
  ]
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.08.24 02:00:00 #
9
+ # Updated Date: 2025.08.26 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Optional, List
@@ -92,9 +92,11 @@ class Loop(BaseRunner):
92
92
 
93
93
  ctx = context.ctx
94
94
  self.send_response(ctx, signals, KernelEvent.APPEND_BEGIN) # lock input, show stop btn
95
+
95
96
  history = context.history
96
97
  tools = self.window.core.agents.observer.evaluation.get_tools()
97
98
  mode = self.window.core.config.get('agent.llama.loop.mode', "score")
99
+
98
100
  prompt = ""
99
101
  if mode == "score":
100
102
  prompt = self.window.core.agents.observer.evaluation.get_prompt_score(history)
@@ -106,8 +108,18 @@ class Loop(BaseRunner):
106
108
  self.next_instruction = "" # reset
107
109
  self.prev_score = -1 # reset
108
110
 
111
+ # select evaluation model
112
+ eval_model = ctx.model
113
+ custom_model = self.window.core.config.get('agent.llama.eval_model', None)
114
+ if custom_model and custom_model != "_":
115
+ eval_model = custom_model
116
+
117
+ if self.is_verbose():
118
+ print("[Evaluation] Prompt:", prompt)
119
+ print("[Evaluation] Running with model:", eval_model)
120
+
109
121
  # run agent once
110
- self.run_once(prompt, tools, ctx.model) # tool will update evaluation
122
+ self.run_once(prompt, tools, eval_model) # tool will update evaluation
111
123
  return self.handle_evaluation(ctx, self.next_instruction, self.prev_score, signals)
112
124
 
113
125
  def handle_evaluation(
@@ -134,11 +146,17 @@ class Loop(BaseRunner):
134
146
  score=str(score)
135
147
  )
136
148
  self.set_status(signals, msg)
149
+
150
+ if self.is_verbose():
151
+ print("[Evaluation] Score:", score)
152
+
137
153
  if score < 0:
138
154
  self.send_response(ctx, signals, KernelEvent.APPEND_END)
139
155
  self.set_idle(signals)
140
156
  return True
141
157
  good_score = self.window.core.config.get("agent.llama.loop.score", 75)
158
+ if self.is_verbose():
159
+ print("[Evaluation] Score needed:", good_score)
142
160
  if score >= good_score != 0:
143
161
  msg = "{status_finished} {score_label}: {score}%".format(
144
162
  status_finished=trans('status.finished'),
@@ -146,6 +164,8 @@ class Loop(BaseRunner):
146
164
  score=str(score)
147
165
  )
148
166
  ctx.extra["agent_eval_finish"] = True
167
+ if self.is_verbose():
168
+ print("[Evaluation] Stopping. Finish with score:", score)
149
169
  self.send_response(ctx, signals, KernelEvent.APPEND_END, msg=msg)
150
170
  self.set_idle(signals)
151
171
  return True
@@ -182,5 +202,18 @@ class Loop(BaseRunner):
182
202
  "agent_idx": preset.idx,
183
203
  "agent_provider": preset.agent_provider,
184
204
  }
205
+ if preset.agent_openai:
206
+ extra["agent_provider"] = preset.agent_provider_openai
207
+ if self.is_verbose():
208
+ print("[Evaluation] Instruction:", instruction)
209
+ print("[Evaluation] Running next step...")
185
210
  context.model = self.window.core.models.get(self.window.core.config.get('model'))
186
- return self.window.core.agents.runner.call(context, extra, signals)
211
+ return self.window.core.agents.runner.call(context, extra, signals)
212
+
213
+ def is_verbose(self) -> bool:
214
+ """
215
+ Check if verbose mode is enabled
216
+
217
+ :return: True if verbose mode is enabled
218
+ """
219
+ return self.window.core.config.get("agent.llama.verbose", False)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "__meta__": {
3
- "version": "2.6.24",
4
- "app.version": "2.6.24",
3
+ "version": "2.6.25",
4
+ "app.version": "2.6.25",
5
5
  "updated_at": "2025-08-26T00:00:00"
6
6
  },
7
7
  "access.audio.event.speech": false,
@@ -52,6 +52,8 @@
52
52
  "agent.idx": "base",
53
53
  "agent.idx.auto_retrieve": false,
54
54
  "agent.iterations": 3,
55
+ "agent.llama.append_eval": false,
56
+ "agent.llama.eval_model": "_",
55
57
  "agent.llama.idx": "base",
56
58
  "agent.llama.loop.enabled": false,
57
59
  "agent.llama.loop.score": 75,
@@ -83,6 +85,7 @@
83
85
  "api_key_perplexity": "",
84
86
  "api_key_xai": "",
85
87
  "api_key_mistral": "",
88
+ "api_key_voyage": "",
86
89
  "api_proxy": "",
87
90
  "api_use_responses": true,
88
91
  "api_use_responses_llama": false,
@@ -238,7 +241,7 @@
238
241
  "llama.idx.embeddings.provider": "openai",
239
242
  "llama.idx.embeddings.args": [
240
243
  {
241
- "name": "model",
244
+ "name": "model_name",
242
245
  "value": "text-embedding-3-small",
243
246
  "type": "str"
244
247
  }
@@ -254,6 +257,14 @@
254
257
  }
255
258
  ],
256
259
  "llama.idx.embeddings.default": [
260
+ {
261
+ "provider": "anthropic",
262
+ "model": "voyage-3.5"
263
+ },
264
+ {
265
+ "provider": "deepseek_api",
266
+ "model": "voyage-3.5"
267
+ },
257
268
  {
258
269
  "provider": "google",
259
270
  "model": "gemini-embedding-001"
@@ -266,9 +277,17 @@
266
277
  "provider": "azure_openai",
267
278
  "model": "text-embedding-3-small"
268
279
  },
280
+ {
281
+ "provider": "mistral_ai",
282
+ "model": "mistral-embed"
283
+ },
269
284
  {
270
285
  "provider": "ollama",
271
286
  "model": ""
287
+ },
288
+ {
289
+ "provider": "x_ai",
290
+ "model": ""
272
291
  }
273
292
  ],
274
293
  "llama.idx.embeddings.limit.rpm": 100,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "__meta__": {
3
- "version": "2.6.24",
4
- "app.version": "2.6.24",
3
+ "version": "2.6.25",
4
+ "app.version": "2.6.25",
5
5
  "updated_at": "2025-08-26T23:07:35"
6
6
  },
7
7
  "items": {
@@ -369,6 +369,25 @@
369
369
  "advanced": false,
370
370
  "tab": "Mistral AI"
371
371
  },
372
+ "api_key_voyage": {
373
+ "section": "api_keys",
374
+ "type": "text",
375
+ "slider": false,
376
+ "label": "settings.api_key.voyage",
377
+ "description": "settings.api_key.voyage.desc",
378
+ "value": "",
379
+ "min": null,
380
+ "max": null,
381
+ "multiplier": null,
382
+ "step": null,
383
+ "extra": {
384
+ "bold": true
385
+ },
386
+ "secret": true,
387
+ "persist": true,
388
+ "advanced": false,
389
+ "tab": "Voyage"
390
+ },
372
391
  "app.env": {
373
392
  "section": "general",
374
393
  "type": "dict",
@@ -1935,6 +1954,24 @@
1935
1954
  "advanced": false,
1936
1955
  "tab": "llama"
1937
1956
  },
1957
+ "agent.llama.eval_model": {
1958
+ "section": "agent",
1959
+ "description": "settings.agent.llama.eval_model.desc",
1960
+ "type": "combo",
1961
+ "use": "models",
1962
+ "use_params": {
1963
+ "allow_empty": true
1964
+ },
1965
+ "slider": true,
1966
+ "label": "settings.agent.llama.eval_model",
1967
+ "value": null,
1968
+ "min": 0,
1969
+ "max": 100,
1970
+ "multiplier": 1,
1971
+ "step": 1,
1972
+ "advanced": false,
1973
+ "tab": "llama"
1974
+ },
1938
1975
  "agent.llama.append_eval": {
1939
1976
  "section": "agent",
1940
1977
  "description": "settings.agent.llama.append_eval.desc",
@@ -1948,7 +1985,7 @@
1948
1985
  "step": 1,
1949
1986
  "advanced": false,
1950
1987
  "tab": "llama"
1951
- },
1988
+ },
1952
1989
  "agent.openai.response.split": {
1953
1990
  "section": "agent",
1954
1991
  "description": "settings.agent.openai.response.split.desc",
@@ -1059,6 +1059,8 @@ settings.agent.idx = Index to use
1059
1059
  settings.agent.idx.auto_retrieve = Auto retrieve additional context from RAG
1060
1060
  settings.agent.idx.auto_retrieve.desc = Auto retrieve additional context from RAG at the beginning if the index is provided.
1061
1061
  settings.agent.idx.desc = Only if sub-mode is Chat with Files, choose the index to use in Autonomous and Experts modes
1062
+ settings.agent.llama.eval_model = Model for evaluation
1063
+ settings.agent.llama.eval_model.desc = Model used for evaluation with score/percentage (loop). If not selected, then current active model will be used.
1062
1064
  settings.agent.llama.append_eval = Append and compare previous evaluation prompt in next evaluation
1063
1065
  settings.agent.llama.append_eval.desc = If enabled, previous improvement prompt will be checked in next eval in loop
1064
1066
  settings.agent.llama.iterations = Max run iterations
@@ -1108,6 +1110,8 @@ settings.api_key.mistral = Mistral AI API KEY
1108
1110
  settings.api_key.mistral.desc = Required for the Mistral AI API.
1109
1111
  settings.api_key.perplexity = Perplexity API KEY
1110
1112
  settings.api_key.perplexity.desc = Required for the Perplexity API.
1113
+ settings.api_key.voyage = VoyageAI API KEY
1114
+ settings.api_key.voyage.desc = Required for the Voyage API - embeddings for Anthropic and DeepSeek API.
1111
1115
  settings.api_key.xai = xAI API KEY
1112
1116
  settings.api_key.xai.desc = Required for the xAI API and Grok models.
1113
1117
  settings.api_proxy = Proxy address
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.08.25 20:00:00 #
9
+ # Updated Date: 2025.08.26 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import copy
@@ -2299,6 +2299,42 @@ class Patch:
2299
2299
  'llama.idx.embeddings.default')
2300
2300
  updated = True
2301
2301
 
2302
+ # < 2.6.25
2303
+ if old < parse_version("2.6.25"):
2304
+ print("Migrating config from < 2.6.25...")
2305
+ if "api_key_voyage" not in data:
2306
+ data["api_key_voyage"] = ""
2307
+ if "agent.llama.eval_model" not in data:
2308
+ data["agent.llama.eval_model"] = "_"
2309
+ if "llama.idx.embeddings.default" in data:
2310
+ providers = []
2311
+ for item in data["llama.idx.embeddings.default"]:
2312
+ p = item.get('provider', '')
2313
+ if p and p not in providers:
2314
+ providers.append(p)
2315
+
2316
+ if "anthropic" not in providers:
2317
+ data["llama.idx.embeddings.default"].append({
2318
+ "provider": "anthropic",
2319
+ "model": "voyage-3.5",
2320
+ })
2321
+ if "deepseek_api" not in providers:
2322
+ data["llama.idx.embeddings.default"].append({
2323
+ "provider": "deepseek_api",
2324
+ "model": "voyage-3.5",
2325
+ })
2326
+ if "mistral_ai" not in providers:
2327
+ data["llama.idx.embeddings.default"].append({
2328
+ "provider": "mistral_ai",
2329
+ "model": "mistral-embed",
2330
+ })
2331
+ if "x_ai" not in providers:
2332
+ data["llama.idx.embeddings.default"].append({
2333
+ "provider": "x_ai",
2334
+ "model": "",
2335
+ })
2336
+ updated = True
2337
+
2302
2338
  # update file
2303
2339
  migrated = False
2304
2340
  if updated:
@@ -6,10 +6,12 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.08.06 01:00:00 #
9
+ # Updated Date: 2025.08.26 19:00:00 #
10
10
  # ================================================== #
11
- from typing import List, Dict
12
11
 
12
+ from typing import List, Dict, Optional
13
+
14
+ from llama_index.core.base.embeddings.base import BaseEmbedding
13
15
  from llama_index.core.llms.llm import BaseLLM as LlamaBaseLLM
14
16
 
15
17
  from pygpt_net.core.types import (
@@ -31,7 +33,7 @@ class AnthropicLLM(BaseLLM):
31
33
  """
32
34
  self.id = "anthropic"
33
35
  self.name = "Anthropic"
34
- self.type = [MODE_LLAMA_INDEX]
36
+ self.type = [MODE_LLAMA_INDEX, "embeddings"]
35
37
 
36
38
  def llama(
37
39
  self,
@@ -51,8 +53,36 @@ class AnthropicLLM(BaseLLM):
51
53
  args = self.parse_args(model.llama_index, window)
52
54
  if "model" not in args:
53
55
  args["model"] = model.id
56
+ if "api_key" not in args or args["api_key"] == "":
57
+ args["api_key"] = window.core.config.get("api_key_anthropic", "")
54
58
  return Anthropic(**args)
55
59
 
60
+ def get_embeddings_model(
61
+ self,
62
+ window,
63
+ config: Optional[List[Dict]] = None
64
+ ) -> BaseEmbedding:
65
+ """
66
+ Return provider instance for embeddings
67
+
68
+ :param window: window instance
69
+ :param config: config keyword arguments list
70
+ :return: Embedding provider instance
71
+ """
72
+ from llama_index.embeddings.voyageai import VoyageEmbedding
73
+ args = {}
74
+ if config is not None:
75
+ args = self.parse_args({
76
+ "args": config,
77
+ }, window)
78
+ if "api_key" in args:
79
+ args["voyage_api_key"] = args.pop("api_key")
80
+ if "voyage_api_key" not in args or args["voyage_api_key"] == "":
81
+ args["voyage_api_key"] = window.core.config.get("api_key_voyage", "")
82
+ if "model" in args and "model_name" not in args:
83
+ args["model_name"] = args.pop("model")
84
+ return VoyageEmbedding(**args)
85
+
56
86
  def get_models(
57
87
  self,
58
88
  window,
@@ -6,14 +6,11 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.08.06 01:00:00 #
9
+ # Updated Date: 2025.08.26 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Optional, List, Dict
13
13
 
14
- # from langchain_openai import AzureOpenAI
15
- # from langchain_openai import AzureChatOpenAI
16
-
17
14
  from llama_index.core.llms.llm import BaseLLM as LlamaBaseLLM
18
15
  from llama_index.core.base.embeddings.base import BaseEmbedding
19
16
 
@@ -93,6 +90,10 @@ class AzureOpenAILLM(BaseLLM):
93
90
  """
94
91
  from llama_index.llms.azure_openai import AzureOpenAI as LlamaAzureOpenAI
95
92
  args = self.parse_args(model.llama_index, window)
93
+ if "api_key" not in args:
94
+ args["api_key"] = window.core.config.get("api_key", "")
95
+ if "model" not in args:
96
+ args["model"] = model.id
96
97
  return LlamaAzureOpenAI(**args)
97
98
 
98
99
  def get_embeddings_model(
@@ -113,4 +114,8 @@ class AzureOpenAILLM(BaseLLM):
113
114
  args = self.parse_args({
114
115
  "args": config,
115
116
  }, window)
117
+ if "api_key" not in args:
118
+ args["api_key"] = window.core.config.get("api_key", "")
119
+ if "model" in args and "model_name" not in args:
120
+ args["model_name"] = args.pop("model")
116
121
  return AzureOpenAIEmbedding(**args)
@@ -6,9 +6,12 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.08.06 01:00:00 #
9
+ # Updated Date: 2025.08.26 19:00:00 #
10
10
  # ================================================== #
11
- from typing import List, Dict
11
+
12
+ from typing import List, Dict, Optional
13
+
14
+ from llama_index.core.base.embeddings.base import BaseEmbedding
12
15
 
13
16
  from pygpt_net.core.types import (
14
17
  MODE_LLAMA_INDEX,
@@ -24,7 +27,7 @@ class DeepseekApiLLM(BaseLLM):
24
27
  super(DeepseekApiLLM, self).__init__(*args, **kwargs)
25
28
  self.id = "deepseek_api"
26
29
  self.name = "Deepseek API"
27
- self.type = [MODE_LLAMA_INDEX]
30
+ self.type = [MODE_LLAMA_INDEX, "embeddings"]
28
31
 
29
32
  def llama(
30
33
  self,
@@ -42,8 +45,38 @@ class DeepseekApiLLM(BaseLLM):
42
45
  """
43
46
  from llama_index.llms.deepseek import DeepSeek
44
47
  args = self.parse_args(model.llama_index, window)
48
+ if "model" not in args:
49
+ args["model"] = model.id
50
+ if "api_key" not in args or args["api_key"] == "":
51
+ args["api_key"] = window.core.config.get("api_key_deepseek", "")
45
52
  return DeepSeek(**args)
46
53
 
54
+ def get_embeddings_model(
55
+ self,
56
+ window,
57
+ config: Optional[List[Dict]] = None
58
+ ) -> BaseEmbedding:
59
+ """
60
+ Return provider instance for embeddings
61
+
62
+ :param window: window instance
63
+ :param config: config keyword arguments list
64
+ :return: Embedding provider instance
65
+ """
66
+ from llama_index.embeddings.voyageai import VoyageEmbedding
67
+ args = {}
68
+ if config is not None:
69
+ args = self.parse_args({
70
+ "args": config,
71
+ }, window)
72
+ if "api_key" in args:
73
+ args["voyage_api_key"] = args.pop("api_key")
74
+ if "voyage_api_key" not in args or args["voyage_api_key"] == "":
75
+ args["voyage_api_key"] = window.core.config.get("api_key_voyage", "")
76
+ if "model" in args and "model_name" not in args:
77
+ args["model_name"] = args.pop("model")
78
+ return VoyageEmbedding(**args)
79
+
47
80
  def get_models(
48
81
  self,
49
82
  window,
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.08.06 01:00:00 #
9
+ # Updated Date: 2025.08.26 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Optional, List, Dict
@@ -53,6 +53,8 @@ class GoogleLLM(BaseLLM):
53
53
  args = self.parse_args(model.llama_index, window)
54
54
  if "model" not in args:
55
55
  args["model"] = model.id
56
+ if "api_key" not in args or args["api_key"] == "":
57
+ args["api_key"] = window.core.config.get("api_key_google", "")
56
58
  return GoogleGenAI(**args)
57
59
 
58
60
  def get_embeddings_model(
@@ -73,6 +75,10 @@ class GoogleLLM(BaseLLM):
73
75
  args = self.parse_args({
74
76
  "args": config,
75
77
  }, window)
78
+ if "api_key" not in args or args["api_key"] == "":
79
+ args["api_key"] = window.core.config.get("api_key_google", "")
80
+ if "model" in args and "model_name" not in args:
81
+ args["model_name"] = args.pop("model")
76
82
  return GoogleGenAIEmbedding(**args)
77
83
 
78
84
  def get_models(
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.08.06 01:00:00 #
9
+ # Updated Date: 2025.08.26 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
@@ -47,6 +47,8 @@ class HuggingFaceApiLLM(BaseLLM):
47
47
  args = self.parse_args(model.llama_index, window)
48
48
  if "model" not in args:
49
49
  args["model"] = model.id
50
+ if "api_key" not in args or args["api_key"] == "":
51
+ args["api_key"] = window.core.config.get("api_key_hugging_face", "")
50
52
  return HuggingFaceInferenceAPI(**args)
51
53
 
52
54
  def get_embeddings_model(
@@ -61,13 +63,17 @@ class HuggingFaceApiLLM(BaseLLM):
61
63
  :param config: config keyword arguments list
62
64
  :return: Embedding provider instance
63
65
  """
64
- from llama_index.embeddings.huggingface_api import HuggingFaceInferenceAPIEmbedding as HuggingFaceAPIEmbedding
66
+ from llama_index.embeddings.huggingface_api import HuggingFaceInferenceAPIEmbedding
65
67
  args = {}
66
68
  if config is not None:
67
69
  args = self.parse_args({
68
70
  "args": config,
69
71
  }, window)
70
- return HuggingFaceAPIEmbedding(**args)
72
+ if "api_key" not in args or args["api_key"] == "":
73
+ args["api_key"] = window.core.config.get("api_key_hugging_face", "")
74
+ if "model" in args and "model_name" not in args:
75
+ args["model_name"] = args.pop("model")
76
+ return HuggingFaceInferenceAPIEmbedding(**args)
71
77
 
72
78
  def init_embeddings(
73
79
  self,