pygpt-net 2.4.47__py3-none-any.whl → 2.4.48__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.
- CHANGELOG.md +8 -0
- README.md +10 -2
- pygpt_net/CHANGELOG.txt +8 -0
- pygpt_net/__init__.py +7 -3
- pygpt_net/controller/dialogs/info.py +18 -1
- pygpt_net/controller/lang/mapping.py +3 -3
- pygpt_net/core/agents/tools.py +3 -3
- pygpt_net/core/idx/__init__.py +16 -11
- pygpt_net/core/idx/chat.py +18 -22
- pygpt_net/core/idx/indexing.py +14 -12
- pygpt_net/core/idx/llm.py +3 -11
- pygpt_net/data/config/config.json +3 -3
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/config/modes.json +3 -3
- pygpt_net/data/locale/locale.de.ini +2 -1
- pygpt_net/data/locale/locale.en.ini +4 -3
- pygpt_net/data/locale/locale.es.ini +2 -1
- pygpt_net/data/locale/locale.fr.ini +2 -1
- pygpt_net/data/locale/locale.it.ini +2 -1
- pygpt_net/data/locale/locale.pl.ini +3 -2
- pygpt_net/data/locale/locale.uk.ini +2 -1
- pygpt_net/data/locale/locale.zh.ini +2 -1
- pygpt_net/provider/llms/google.py +25 -2
- pygpt_net/provider/llms/openai.py +1 -1
- pygpt_net/provider/loaders/hub/github/issues.py +5 -5
- pygpt_net/provider/loaders/hub/json/base.py +2 -2
- pygpt_net/provider/loaders/hub/pandas_excel/base.py +2 -2
- pygpt_net/provider/loaders/hub/simple_csv/base.py +2 -2
- pygpt_net/provider/loaders/hub/yt/base.py +1 -1
- pygpt_net/provider/vector_stores/__init__.py +19 -11
- pygpt_net/provider/vector_stores/base.py +11 -7
- pygpt_net/provider/vector_stores/chroma.py +11 -5
- pygpt_net/provider/vector_stores/ctx_attachment.py +7 -5
- pygpt_net/provider/vector_stores/elasticsearch.py +11 -5
- pygpt_net/provider/vector_stores/pinecode.py +11 -5
- pygpt_net/provider/vector_stores/redis.py +11 -5
- pygpt_net/provider/vector_stores/simple.py +7 -5
- pygpt_net/provider/vector_stores/temp.py +7 -5
- pygpt_net/ui/layout/chat/output.py +1 -2
- pygpt_net/ui/menu/__init__.py +4 -1
- pygpt_net/ui/menu/about.py +6 -7
- pygpt_net/ui/menu/donate.py +46 -0
- pygpt_net/ui/widget/anims/toggles.py +1 -1
- pygpt_net/utils.py +20 -7
- {pygpt_net-2.4.47.dist-info → pygpt_net-2.4.48.dist-info}/METADATA +43 -33
- {pygpt_net-2.4.47.dist-info → pygpt_net-2.4.48.dist-info}/RECORD +49 -48
- {pygpt_net-2.4.47.dist-info → pygpt_net-2.4.48.dist-info}/LICENSE +0 -0
- {pygpt_net-2.4.47.dist-info → pygpt_net-2.4.48.dist-info}/WHEEL +0 -0
- {pygpt_net-2.4.47.dist-info → pygpt_net-2.4.48.dist-info}/entry_points.txt +0 -0
@@ -6,11 +6,15 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date:
|
9
|
+
# Updated Date: 2025.01.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
|
+
from typing import Optional, List, Dict
|
13
|
+
|
12
14
|
from llama_index.llms.gemini import Gemini
|
13
15
|
from llama_index.core.llms.llm import BaseLLM as LlamaBaseLLM
|
16
|
+
from llama_index.core.base.embeddings.base import BaseEmbedding
|
17
|
+
from llama_index.embeddings.gemini import GeminiEmbedding
|
14
18
|
|
15
19
|
from pygpt_net.core.types import (
|
16
20
|
MODE_LLAMA_INDEX,
|
@@ -30,7 +34,7 @@ class GoogleLLM(BaseLLM):
|
|
30
34
|
- api_key: API key for Google API
|
31
35
|
"""
|
32
36
|
self.id = "google"
|
33
|
-
self.type = [MODE_LLAMA_INDEX]
|
37
|
+
self.type = [MODE_LLAMA_INDEX, "embeddings"]
|
34
38
|
|
35
39
|
def llama(
|
36
40
|
self,
|
@@ -48,3 +52,22 @@ class GoogleLLM(BaseLLM):
|
|
48
52
|
"""
|
49
53
|
args = self.parse_args(model.llama_index)
|
50
54
|
return Gemini(**args)
|
55
|
+
|
56
|
+
def get_embeddings_model(
|
57
|
+
self,
|
58
|
+
window,
|
59
|
+
config: Optional[List[Dict]] = None
|
60
|
+
) -> BaseEmbedding:
|
61
|
+
"""
|
62
|
+
Return provider instance for embeddings
|
63
|
+
|
64
|
+
:param window: window instance
|
65
|
+
:param config: config keyword arguments list
|
66
|
+
:return: Embedding provider instance
|
67
|
+
"""
|
68
|
+
args = {}
|
69
|
+
if config is not None:
|
70
|
+
args = self.parse_args({
|
71
|
+
"args": config,
|
72
|
+
})
|
73
|
+
return GeminiEmbedding(**args)
|
@@ -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:
|
9
|
+
# Updated Date: 2025.01.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from typing import Optional, List, Dict
|
@@ -89,7 +89,7 @@ class GitHubRepositoryIssuesReader(BaseGitHubRepositoryIssuesReader):
|
|
89
89
|
doc_id=str(issue["number"]),
|
90
90
|
text=f"{title}\n{body}",
|
91
91
|
)
|
92
|
-
|
92
|
+
metadata = {
|
93
93
|
"state": issue["state"],
|
94
94
|
"created_at": issue["created_at"],
|
95
95
|
# url is the API URL
|
@@ -98,12 +98,12 @@ class GitHubRepositoryIssuesReader(BaseGitHubRepositoryIssuesReader):
|
|
98
98
|
"source": issue["html_url"],
|
99
99
|
}
|
100
100
|
if issue["closed_at"] is not None:
|
101
|
-
|
101
|
+
metadata["closed_at"] = issue["closed_at"]
|
102
102
|
if issue["assignee"] is not None:
|
103
|
-
|
103
|
+
metadata["assignee"] = issue["assignee"]["login"]
|
104
104
|
if issue["labels"] is not None:
|
105
|
-
|
106
|
-
document.
|
105
|
+
metadata["labels"] = ",".join([label["name"] for label in issue["labels"]]) # fix for labels
|
106
|
+
document.metadata = metadata
|
107
107
|
documents.append(document)
|
108
108
|
|
109
109
|
print_if_verbose(self._verbose, f"Resulted in {len(documents)} documents")
|
@@ -68,11 +68,11 @@ class JSONReader(BaseReader):
|
|
68
68
|
useful_lines = [
|
69
69
|
line for line in lines if not re.match(r"^[{}\\[\\],]*$", line)
|
70
70
|
]
|
71
|
-
return Document(text="\n".join(useful_lines),
|
71
|
+
return Document(text="\n".join(useful_lines), metadata=extra_info or {})
|
72
72
|
|
73
73
|
else:
|
74
74
|
lines = [*_depth_first_yield(json_data_object, self.levels_back, [])]
|
75
|
-
return Document(text="\n".join(lines),
|
75
|
+
return Document(text="\n".join(lines), metadata=extra_info or {})
|
76
76
|
|
77
77
|
def load_data(
|
78
78
|
self,
|
@@ -86,7 +86,7 @@ class PandasExcelReader(BaseReader):
|
|
86
86
|
documents.append(
|
87
87
|
Document(
|
88
88
|
text=text,
|
89
|
-
|
89
|
+
metadata=doc_extra_info,
|
90
90
|
)
|
91
91
|
)
|
92
92
|
return documents
|
@@ -107,6 +107,6 @@ class PandasExcelReader(BaseReader):
|
|
107
107
|
return [
|
108
108
|
Document(
|
109
109
|
text=text,
|
110
|
-
|
110
|
+
metadata=extra_info or {},
|
111
111
|
)
|
112
112
|
]
|
@@ -46,8 +46,8 @@ class SimpleCSVReader(BaseReader):
|
|
46
46
|
for row in csv_reader:
|
47
47
|
text_list.append(", ".join(row))
|
48
48
|
if self._concat_rows:
|
49
|
-
return [Document(text="\n".join(text_list),
|
49
|
+
return [Document(text="\n".join(text_list), metadata=extra_info or {})]
|
50
50
|
else:
|
51
51
|
return [
|
52
|
-
Document(text=text,
|
52
|
+
Document(text=text, metadata=extra_info or {}) for text in text_list
|
53
53
|
]
|
@@ -59,7 +59,7 @@ class YoutubeTranscriptReader(BasePydanticReader):
|
|
59
59
|
transcript = "\n".join(chunk_text)
|
60
60
|
results.append(
|
61
61
|
Document(
|
62
|
-
text=transcript, id_=video_id,
|
62
|
+
text=transcript, id_=video_id, metadata={"video_id": video_id}
|
63
63
|
)
|
64
64
|
)
|
65
65
|
return results
|
@@ -6,13 +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:
|
9
|
+
# Updated Date: 2025.01.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import hashlib
|
13
13
|
from typing import Optional, Tuple, List
|
14
14
|
|
15
|
-
from llama_index.core.indices.service_context import ServiceContext
|
16
15
|
from llama_index.core.indices.base import BaseIndex
|
17
16
|
from llama_index.core.indices.vector_store.base import VectorStoreIndex
|
18
17
|
|
@@ -110,13 +109,15 @@ class Storage:
|
|
110
109
|
def get(
|
111
110
|
self,
|
112
111
|
id: str,
|
113
|
-
|
112
|
+
llm: Optional = None,
|
113
|
+
embed_model: Optional = None,
|
114
114
|
) -> BaseIndex:
|
115
115
|
"""
|
116
116
|
Get index instance
|
117
117
|
|
118
118
|
:param id: index name
|
119
|
-
:param
|
119
|
+
:param llm: LLM instance
|
120
|
+
:param embed_model: Embedding model instance
|
120
121
|
:return: index instance
|
121
122
|
"""
|
122
123
|
storage = self.get_storage()
|
@@ -124,7 +125,8 @@ class Storage:
|
|
124
125
|
raise Exception('Storage engine not found!')
|
125
126
|
return storage.get(
|
126
127
|
id=id,
|
127
|
-
|
128
|
+
llm=llm,
|
129
|
+
embed_model=embed_model,
|
128
130
|
)
|
129
131
|
|
130
132
|
def store(
|
@@ -189,13 +191,15 @@ class Storage:
|
|
189
191
|
def get_tmp(
|
190
192
|
self,
|
191
193
|
identifier: str,
|
192
|
-
|
194
|
+
llm: Optional = None,
|
195
|
+
embed_model: Optional = None,
|
193
196
|
) -> Tuple[str, BaseIndex]:
|
194
197
|
"""
|
195
198
|
Get tmp index instance
|
196
199
|
|
197
200
|
:param identifier: identifier
|
198
|
-
:param
|
201
|
+
:param llm: LLM instance
|
202
|
+
:param embed_model: Embedding model instance
|
199
203
|
:return: index instance
|
200
204
|
"""
|
201
205
|
# convert path to md5 hash
|
@@ -205,7 +209,8 @@ class Storage:
|
|
205
209
|
raise Exception('Storage engine not found!')
|
206
210
|
return id, storage.get(
|
207
211
|
id=id,
|
208
|
-
|
212
|
+
llm=llm,
|
213
|
+
embed_model=embed_model,
|
209
214
|
)
|
210
215
|
|
211
216
|
def store_tmp(
|
@@ -252,13 +257,15 @@ class Storage:
|
|
252
257
|
def get_ctx_idx(
|
253
258
|
self,
|
254
259
|
path: str,
|
255
|
-
|
260
|
+
llm: Optional = None,
|
261
|
+
embed_model: Optional = None,
|
256
262
|
) -> BaseIndex:
|
257
263
|
"""
|
258
264
|
Get context index instance
|
259
265
|
|
260
266
|
:param path: path to index directory
|
261
|
-
:param
|
267
|
+
:param llm: LLM instance
|
268
|
+
:param embed_model: Embedding model instance
|
262
269
|
:return: index instance
|
263
270
|
"""
|
264
271
|
# convert path to md5 hash
|
@@ -267,7 +274,8 @@ class Storage:
|
|
267
274
|
raise Exception('Storage engine not found!')
|
268
275
|
return storage.get(
|
269
276
|
id="",
|
270
|
-
|
277
|
+
llm=llm,
|
278
|
+
embed_model=embed_model,
|
271
279
|
)
|
272
280
|
|
273
281
|
def store_ctx_idx(
|
@@ -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:
|
9
|
+
# Updated Date: 2025.01.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os
|
@@ -14,7 +14,6 @@ import shutil
|
|
14
14
|
from typing import Optional
|
15
15
|
|
16
16
|
from llama_index.core.indices.base import BaseIndex
|
17
|
-
from llama_index.core.indices.service_context import ServiceContext
|
18
17
|
from llama_index.core import StorageContext
|
19
18
|
from llama_index.core.indices.vector_store.base import VectorStoreIndex
|
20
19
|
|
@@ -36,20 +35,23 @@ class BaseStore:
|
|
36
35
|
self,
|
37
36
|
vector_store,
|
38
37
|
storage_context: StorageContext,
|
39
|
-
|
38
|
+
llm: Optional = None,
|
39
|
+
embed_model: Optional = None,
|
40
40
|
):
|
41
41
|
"""
|
42
42
|
Get index instance
|
43
43
|
|
44
44
|
:param vector_store: vector store instance
|
45
45
|
:param storage_context: StorageContext instance
|
46
|
-
:param
|
46
|
+
:param llm: LLM instance
|
47
|
+
:param embed_model: Embedding model instance
|
47
48
|
:return: index instance
|
48
49
|
"""
|
49
50
|
return VectorStoreIndex.from_vector_store(
|
50
51
|
vector_store,
|
51
52
|
storage_context=storage_context,
|
52
|
-
|
53
|
+
llm=llm,
|
54
|
+
embed_model=embed_model,
|
53
55
|
)
|
54
56
|
|
55
57
|
def index_from_empty(self):
|
@@ -106,13 +108,15 @@ class BaseStore:
|
|
106
108
|
def get(
|
107
109
|
self,
|
108
110
|
id: str,
|
109
|
-
|
111
|
+
llm: Optional = None,
|
112
|
+
embed_model: Optional = None,
|
110
113
|
) -> BaseIndex:
|
111
114
|
"""
|
112
115
|
Get index instance
|
113
116
|
|
114
117
|
:param id: index name
|
115
|
-
:param
|
118
|
+
:param llm: LLM instance
|
119
|
+
:param embed_model: Embedding model instance
|
116
120
|
:return: index instance
|
117
121
|
"""
|
118
122
|
pass
|
@@ -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:
|
9
|
+
# Updated Date: 2025.01.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os.path
|
@@ -16,7 +16,6 @@ import chromadb
|
|
16
16
|
from chromadb.config import Settings
|
17
17
|
|
18
18
|
from llama_index.core.indices.base import BaseIndex
|
19
|
-
from llama_index.core.indices.service_context import ServiceContext
|
20
19
|
from llama_index.core import StorageContext
|
21
20
|
from llama_index.vector_stores.chroma import ChromaVectorStore
|
22
21
|
|
@@ -69,13 +68,15 @@ class ChromaProvider(BaseStore):
|
|
69
68
|
def get(
|
70
69
|
self,
|
71
70
|
id: str,
|
72
|
-
|
71
|
+
llm: Optional = None,
|
72
|
+
embed_model: Optional = None,
|
73
73
|
) -> BaseIndex:
|
74
74
|
"""
|
75
75
|
Get index
|
76
76
|
|
77
77
|
:param id: index name
|
78
|
-
:param
|
78
|
+
:param llm: LLM instance
|
79
|
+
:param embed_model: Embedding model instance
|
79
80
|
:return: index instance
|
80
81
|
"""
|
81
82
|
if not self.exists(id):
|
@@ -89,7 +90,12 @@ class ChromaProvider(BaseStore):
|
|
89
90
|
storage_context = StorageContext.from_defaults(
|
90
91
|
persist_dir=path,
|
91
92
|
)
|
92
|
-
self.indexes[id] = self.index_from_store(
|
93
|
+
self.indexes[id] = self.index_from_store(
|
94
|
+
vector_store=vector_store,
|
95
|
+
storage_context=storage_context,
|
96
|
+
llm=llm,
|
97
|
+
embed_model=embed_model,
|
98
|
+
)
|
93
99
|
return self.indexes[id]
|
94
100
|
|
95
101
|
def store(
|
@@ -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:
|
9
|
+
# Updated Date: 2025.01.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os.path
|
@@ -14,7 +14,6 @@ from typing import Optional
|
|
14
14
|
|
15
15
|
from llama_index.core import StorageContext, load_index_from_storage
|
16
16
|
from llama_index.core.indices.base import BaseIndex
|
17
|
-
from llama_index.core.indices.service_context import ServiceContext
|
18
17
|
|
19
18
|
from .base import BaseStore
|
20
19
|
|
@@ -76,13 +75,15 @@ class CtxAttachmentProvider(BaseStore):
|
|
76
75
|
def get(
|
77
76
|
self,
|
78
77
|
id: str,
|
79
|
-
|
78
|
+
llm: Optional = None,
|
79
|
+
embed_model: Optional = None,
|
80
80
|
) -> BaseIndex:
|
81
81
|
"""
|
82
82
|
Get index
|
83
83
|
|
84
84
|
:param id: index name (not used)
|
85
|
-
:param
|
85
|
+
:param llm: LLM instance
|
86
|
+
:param embed_model: Embedding model instance
|
86
87
|
:return: index instance
|
87
88
|
"""
|
88
89
|
if not self.exists():
|
@@ -93,7 +94,8 @@ class CtxAttachmentProvider(BaseStore):
|
|
93
94
|
)
|
94
95
|
self.index = load_index_from_storage(
|
95
96
|
storage_context,
|
96
|
-
|
97
|
+
llm=llm,
|
98
|
+
embed_model=embed_model,
|
97
99
|
)
|
98
100
|
|
99
101
|
return self.index
|
@@ -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:
|
9
|
+
# Updated Date: 2025.01.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import datetime
|
@@ -14,7 +14,6 @@ import os.path
|
|
14
14
|
from typing import Optional
|
15
15
|
|
16
16
|
from llama_index.core.indices.base import BaseIndex
|
17
|
-
from llama_index.core.indices.service_context import ServiceContext
|
18
17
|
from llama_index.core import StorageContext
|
19
18
|
from llama_index.vector_stores.elasticsearch import ElasticsearchStore
|
20
19
|
|
@@ -71,13 +70,15 @@ class ElasticsearchProvider(BaseStore):
|
|
71
70
|
def get(
|
72
71
|
self,
|
73
72
|
id: str,
|
74
|
-
|
73
|
+
llm: Optional = None,
|
74
|
+
embed_model: Optional = None,
|
75
75
|
) -> BaseIndex:
|
76
76
|
"""
|
77
77
|
Get index
|
78
78
|
|
79
79
|
:param id: index name
|
80
|
-
:param
|
80
|
+
:param llm: LLM instance
|
81
|
+
:param embed_model: Embedding model instance
|
81
82
|
:return: index instance
|
82
83
|
"""
|
83
84
|
if not self.exists(id):
|
@@ -86,7 +87,12 @@ class ElasticsearchProvider(BaseStore):
|
|
86
87
|
storage_context = StorageContext.from_defaults(
|
87
88
|
vector_store=vector_store,
|
88
89
|
)
|
89
|
-
self.indexes[id] = self.index_from_store(
|
90
|
+
self.indexes[id] = self.index_from_store(
|
91
|
+
vector_store=vector_store,
|
92
|
+
storage_context=storage_context,
|
93
|
+
llm=llm,
|
94
|
+
embed_model=embed_model,
|
95
|
+
)
|
90
96
|
return self.indexes[id]
|
91
97
|
|
92
98
|
def store(
|
@@ -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:
|
9
|
+
# Updated Date: 2025.01.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import datetime
|
@@ -17,7 +17,6 @@ from pinecone import Pinecone, ServerlessSpec
|
|
17
17
|
|
18
18
|
from llama_index.core import StorageContext
|
19
19
|
from llama_index.core.indices.base import BaseIndex
|
20
|
-
from llama_index.core.indices.service_context import ServiceContext
|
21
20
|
from llama_index.vector_stores.pinecone import PineconeVectorStore
|
22
21
|
|
23
22
|
from pygpt_net.utils import parse_args
|
@@ -126,13 +125,15 @@ class PinecodeProvider(BaseStore):
|
|
126
125
|
def get(
|
127
126
|
self,
|
128
127
|
id: str,
|
129
|
-
|
128
|
+
llm: Optional = None,
|
129
|
+
embed_model: Optional = None,
|
130
130
|
) -> BaseIndex:
|
131
131
|
"""
|
132
132
|
Get index
|
133
133
|
|
134
134
|
:param id: index name
|
135
|
-
:param
|
135
|
+
:param llm: LLM instance
|
136
|
+
:param embed_model: Embedding model instance
|
136
137
|
:return: index instance
|
137
138
|
"""
|
138
139
|
if not self.exists(id):
|
@@ -141,7 +142,12 @@ class PinecodeProvider(BaseStore):
|
|
141
142
|
storage_context = StorageContext.from_defaults(
|
142
143
|
vector_store=vector_store,
|
143
144
|
)
|
144
|
-
self.indexes[id] = self.index_from_store(
|
145
|
+
self.indexes[id] = self.index_from_store(
|
146
|
+
vector_store=vector_store,
|
147
|
+
storage_context=storage_context,
|
148
|
+
llm=llm,
|
149
|
+
embed_model=embed_model,
|
150
|
+
)
|
145
151
|
return self.indexes[id]
|
146
152
|
|
147
153
|
def store(
|
@@ -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:
|
9
|
+
# Updated Date: 2025.01.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import datetime
|
@@ -15,7 +15,6 @@ from typing import Optional
|
|
15
15
|
|
16
16
|
from llama_index.core import StorageContext
|
17
17
|
from llama_index.core.indices.base import BaseIndex
|
18
|
-
from llama_index.core.indices.service_context import ServiceContext
|
19
18
|
from llama_index.vector_stores.redis import RedisVectorStore
|
20
19
|
|
21
20
|
from pygpt_net.utils import parse_args
|
@@ -71,13 +70,15 @@ class RedisProvider(BaseStore):
|
|
71
70
|
def get(
|
72
71
|
self,
|
73
72
|
id: str,
|
74
|
-
|
73
|
+
llm: Optional = None,
|
74
|
+
embed_model: Optional = None,
|
75
75
|
) -> BaseIndex:
|
76
76
|
"""
|
77
77
|
Get index
|
78
78
|
|
79
79
|
:param id: index name
|
80
|
-
:param
|
80
|
+
:param llm: LLM instance
|
81
|
+
:param embed_model: Embedding model instance
|
81
82
|
:return: index instance
|
82
83
|
"""
|
83
84
|
if not self.exists(id):
|
@@ -86,7 +87,12 @@ class RedisProvider(BaseStore):
|
|
86
87
|
storage_context = StorageContext.from_defaults(
|
87
88
|
vector_store=vector_store,
|
88
89
|
)
|
89
|
-
self.indexes[id] = self.index_from_store(
|
90
|
+
self.indexes[id] = self.index_from_store(
|
91
|
+
vector_store=vector_store,
|
92
|
+
storage_context=storage_context,
|
93
|
+
llm=llm,
|
94
|
+
embed_model=embed_model,
|
95
|
+
)
|
90
96
|
return self.indexes[id]
|
91
97
|
|
92
98
|
def store(
|
@@ -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:
|
9
|
+
# Updated Date: 2025.01.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os.path
|
@@ -14,7 +14,6 @@ from typing import Optional
|
|
14
14
|
|
15
15
|
from llama_index.core import StorageContext, load_index_from_storage
|
16
16
|
from llama_index.core.indices.base import BaseIndex
|
17
|
-
from llama_index.core.indices.service_context import ServiceContext
|
18
17
|
|
19
18
|
from .base import BaseStore
|
20
19
|
|
@@ -50,13 +49,15 @@ class SimpleProvider(BaseStore):
|
|
50
49
|
def get(
|
51
50
|
self,
|
52
51
|
id: str,
|
53
|
-
|
52
|
+
llm: Optional = None,
|
53
|
+
embed_model: Optional = None,
|
54
54
|
) -> BaseIndex:
|
55
55
|
"""
|
56
56
|
Get index
|
57
57
|
|
58
58
|
:param id: index name
|
59
|
-
:param
|
59
|
+
:param llm: LLM instance
|
60
|
+
:param embed_model: Embedding model instance
|
60
61
|
:return: index instance
|
61
62
|
"""
|
62
63
|
if not self.exists(id):
|
@@ -67,7 +68,8 @@ class SimpleProvider(BaseStore):
|
|
67
68
|
)
|
68
69
|
self.indexes[id] = load_index_from_storage(
|
69
70
|
storage_context,
|
70
|
-
|
71
|
+
llm=llm,
|
72
|
+
embed_model=embed_model,
|
71
73
|
)
|
72
74
|
return self.indexes[id]
|
73
75
|
|
@@ -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:
|
9
|
+
# Updated Date: 2025.01.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os.path
|
@@ -14,7 +14,6 @@ from typing import Optional
|
|
14
14
|
|
15
15
|
from llama_index.core import StorageContext, load_index_from_storage
|
16
16
|
from llama_index.core.indices.base import BaseIndex
|
17
|
-
from llama_index.core.indices.service_context import ServiceContext
|
18
17
|
|
19
18
|
from .base import BaseStore
|
20
19
|
|
@@ -107,13 +106,15 @@ class TempProvider(BaseStore):
|
|
107
106
|
def get(
|
108
107
|
self,
|
109
108
|
id: str,
|
110
|
-
|
109
|
+
llm: Optional = None,
|
110
|
+
embed_model: Optional = None,
|
111
111
|
) -> BaseIndex:
|
112
112
|
"""
|
113
113
|
Get index
|
114
114
|
|
115
115
|
:param id: tmp idx id
|
116
|
-
:param
|
116
|
+
:param llm: LLM instance
|
117
|
+
:param embed_model: Embedding model instance
|
117
118
|
:return: index instance
|
118
119
|
"""
|
119
120
|
if not self.exists(id):
|
@@ -126,7 +127,8 @@ class TempProvider(BaseStore):
|
|
126
127
|
)
|
127
128
|
self.indexes[id] = load_index_from_storage(
|
128
129
|
storage_context,
|
129
|
-
|
130
|
+
llm=llm,
|
131
|
+
embed_model=embed_model,
|
130
132
|
)
|
131
133
|
|
132
134
|
return self.indexes[id]
|
@@ -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:
|
9
|
+
# Updated Date: 2025.01.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from PySide6.QtCore import Qt
|
@@ -160,7 +160,6 @@ class Output:
|
|
160
160
|
self.window.ui.nodes['inline.vision'] = HelpLabel(trans('inline.vision'))
|
161
161
|
self.window.ui.nodes['inline.vision'].setVisible(False)
|
162
162
|
self.window.ui.nodes['inline.vision'].setContentsMargins(0, 0, 0, 0)
|
163
|
-
self.window.ui.nodes['inline.vision'].setToolTip(trans('vision.checkbox.tooltip'))
|
164
163
|
|
165
164
|
opts_layout = QHBoxLayout()
|
166
165
|
# opts_layout.setSpacing(2) #
|