Spaces:
Build error
Build error
Katsuya Oda
commited on
Commit
•
5285b72
0
Parent(s):
Initial commit
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .dockerignore +1 -0
- .env.dev +0 -0
- .env.production +0 -0
- .gitattributes +40 -0
- .gitignore +513 -0
- .gitignore.d/Archives.gitignore +32 -0
- .gitignore.d/Backup.gitignore +5 -0
- .gitignore.d/GPG.gitignore +1 -0
- .gitignore.d/Linux.gitignore +13 -0
- .gitignore.d/Local.gitignore +6 -0
- .gitignore.d/Node.gitignore +130 -0
- .gitignore.d/Python.gitignore +160 -0
- .gitignore.d/Tags.gitignore +16 -0
- .gitignore.d/Terraform.gitignore +34 -0
- .gitignore.d/Vim.gitignore +19 -0
- .gitignore.d/VisualStudioCode.gitignore +12 -0
- .gitignore.d/Windows.gitignore +24 -0
- .gitignore.d/Xcode.gitignore +6 -0
- .gitignore.d/macOS.gitignore +27 -0
- .lfsconfig +2 -0
- .node-version +1 -0
- .npmrc +1 -0
- .python-version +1 -0
- Dockerfile +48 -0
- LICENSE.txt +661 -0
- Makefile +69 -0
- README.md +88 -0
- backend/__init__.py +33 -0
- backend/cache.py +4 -0
- backend/data.py +117 -0
- backend/generated/schema_types.py +104 -0
- backend/graphql.py +15 -0
- backend/logger.py +26 -0
- backend/resolver.py +308 -0
- backend/settings.py +9 -0
- backend_vespa/Makefile +50 -0
- backend_vespa/multilingual-e5-small-quantized/model_quantized.onnx +3 -0
- backend_vespa/multilingual-e5-small-quantized/ort_config.json +3 -0
- backend_vespa/multilingual-e5-small-quantized/sentencepiece.bpe.model +3 -0
- backend_vespa/multilingual-e5-small-quantized/special_tokens_map.json +3 -0
- backend_vespa/multilingual-e5-small-quantized/tokenizer.json +3 -0
- backend_vespa/multilingual-e5-small-quantized/tokenizer_config.json +3 -0
- backend_vespa/multilingual-e5-small/model.onnx +3 -0
- backend_vespa/multilingual-e5-small/sentencepiece.bpe.model +3 -0
- backend_vespa/multilingual-e5-small/special_tokens_map.json +3 -0
- backend_vespa/multilingual-e5-small/tokenizer.json +3 -0
- backend_vespa/multilingual-e5-small/tokenizer_config.json +3 -0
- backend_vespa/pom.xml +74 -0
- backend_vespa/src/main/application/components/kuromoji-linguistics-2.0.3.jar +3 -0
- backend_vespa/src/main/application/model/.keep +0 -0
.dockerignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.gitignore
|
.env.dev
ADDED
File without changes
|
.env.production
ADDED
File without changes
|
.gitattributes
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
*.jar filter=lfs diff=lfs merge=lfs -text
|
37 |
+
backend_vespa/src/main/application/model/* filter=lfs diff=lfs merge=lfs -text
|
38 |
+
backend_vespa/multilingual-e5-small/*.json filter=lfs diff=lfs merge=lfs -text
|
39 |
+
backend_vespa/multilingual-e5-small-quantized/*.json filter=lfs diff=lfs merge=lfs -text
|
40 |
+
data/* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1,513 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## .gitignore.d/Archives.gitignore START
|
2 |
+
# It's better to unpack these files and commit the raw source because
|
3 |
+
# git has its own built in compression methods.
|
4 |
+
*.7z
|
5 |
+
*.jar
|
6 |
+
*.rar
|
7 |
+
*.zip
|
8 |
+
*.gz
|
9 |
+
*.gzip
|
10 |
+
*.tgz
|
11 |
+
*.bzip
|
12 |
+
*.bzip2
|
13 |
+
*.bz2
|
14 |
+
*.xz
|
15 |
+
*.lzma
|
16 |
+
*.cab
|
17 |
+
*.xar
|
18 |
+
|
19 |
+
# Packing-only formats
|
20 |
+
*.iso
|
21 |
+
*.tar
|
22 |
+
|
23 |
+
# Package management formats
|
24 |
+
*.dmg
|
25 |
+
*.xpi
|
26 |
+
*.gem
|
27 |
+
*.egg
|
28 |
+
*.deb
|
29 |
+
*.rpm
|
30 |
+
*.msi
|
31 |
+
*.msm
|
32 |
+
*.msp
|
33 |
+
*.txz
|
34 |
+
## .gitignore.d/Archives.gitignore END
|
35 |
+
## .gitignore.d/Backup.gitignore START
|
36 |
+
*.bak
|
37 |
+
*.gho
|
38 |
+
*.ori
|
39 |
+
*.orig
|
40 |
+
*.tmp
|
41 |
+
## .gitignore.d/Backup.gitignore END
|
42 |
+
## .gitignore.d/GPG.gitignore START
|
43 |
+
secring.*
|
44 |
+
## .gitignore.d/GPG.gitignore END
|
45 |
+
## .gitignore.d/Linux.gitignore START
|
46 |
+
*~
|
47 |
+
|
48 |
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
49 |
+
.fuse_hidden*
|
50 |
+
|
51 |
+
# KDE directory preferences
|
52 |
+
.directory
|
53 |
+
|
54 |
+
# Linux trash folder which might appear on any partition or disk
|
55 |
+
.Trash-*
|
56 |
+
|
57 |
+
# .nfs files are created when an open file is removed but is still being accessed
|
58 |
+
.nfs*
|
59 |
+
## .gitignore.d/Linux.gitignore END
|
60 |
+
## .gitignore.d/Local.gitignore START
|
61 |
+
tmp
|
62 |
+
.ruff_cache
|
63 |
+
**/__pycache__
|
64 |
+
|
65 |
+
backend_vespa/multilingual-e5-*/*
|
66 |
+
backend_vespa/multilingual-e5-*-quantized/*
|
67 |
+
## .gitignore.d/Local.gitignore END
|
68 |
+
## .gitignore.d/Node.gitignore START
|
69 |
+
# Logs
|
70 |
+
logs
|
71 |
+
*.log
|
72 |
+
npm-debug.log*
|
73 |
+
yarn-debug.log*
|
74 |
+
yarn-error.log*
|
75 |
+
lerna-debug.log*
|
76 |
+
.pnpm-debug.log*
|
77 |
+
|
78 |
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
79 |
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
80 |
+
|
81 |
+
# Runtime data
|
82 |
+
pids
|
83 |
+
*.pid
|
84 |
+
*.seed
|
85 |
+
*.pid.lock
|
86 |
+
|
87 |
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
88 |
+
lib-cov
|
89 |
+
|
90 |
+
# Coverage directory used by tools like istanbul
|
91 |
+
coverage
|
92 |
+
*.lcov
|
93 |
+
|
94 |
+
# nyc test coverage
|
95 |
+
.nyc_output
|
96 |
+
|
97 |
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
98 |
+
.grunt
|
99 |
+
|
100 |
+
# Bower dependency directory (https://bower.io/)
|
101 |
+
bower_components
|
102 |
+
|
103 |
+
# node-waf configuration
|
104 |
+
.lock-wscript
|
105 |
+
|
106 |
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
107 |
+
build/Release
|
108 |
+
|
109 |
+
# Dependency directories
|
110 |
+
node_modules/
|
111 |
+
jspm_packages/
|
112 |
+
|
113 |
+
# Snowpack dependency directory (https://snowpack.dev/)
|
114 |
+
web_modules/
|
115 |
+
|
116 |
+
# TypeScript cache
|
117 |
+
*.tsbuildinfo
|
118 |
+
|
119 |
+
# Optional npm cache directory
|
120 |
+
.npm
|
121 |
+
|
122 |
+
# Optional eslint cache
|
123 |
+
.eslintcache
|
124 |
+
|
125 |
+
# Optional stylelint cache
|
126 |
+
.stylelintcache
|
127 |
+
|
128 |
+
# Microbundle cache
|
129 |
+
.rpt2_cache/
|
130 |
+
.rts2_cache_cjs/
|
131 |
+
.rts2_cache_es/
|
132 |
+
.rts2_cache_umd/
|
133 |
+
|
134 |
+
# Optional REPL history
|
135 |
+
.node_repl_history
|
136 |
+
|
137 |
+
# Output of 'npm pack'
|
138 |
+
*.tgz
|
139 |
+
|
140 |
+
# Yarn Integrity file
|
141 |
+
.yarn-integrity
|
142 |
+
|
143 |
+
# dotenv environment variable files
|
144 |
+
# .env
|
145 |
+
.env.development.local
|
146 |
+
.env.test.local
|
147 |
+
.env.production.local
|
148 |
+
.env.local
|
149 |
+
|
150 |
+
# parcel-bundler cache (https://parceljs.org/)
|
151 |
+
.cache
|
152 |
+
.parcel-cache
|
153 |
+
|
154 |
+
# Next.js build output
|
155 |
+
.next
|
156 |
+
out
|
157 |
+
|
158 |
+
# Nuxt.js build / generate output
|
159 |
+
.nuxt
|
160 |
+
dist
|
161 |
+
|
162 |
+
# Gatsby files
|
163 |
+
.cache/
|
164 |
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
165 |
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
166 |
+
# public
|
167 |
+
|
168 |
+
# vuepress build output
|
169 |
+
.vuepress/dist
|
170 |
+
|
171 |
+
# vuepress v2.x temp and cache directory
|
172 |
+
.temp
|
173 |
+
.cache
|
174 |
+
|
175 |
+
# Docusaurus cache and generated files
|
176 |
+
.docusaurus
|
177 |
+
|
178 |
+
# Serverless directories
|
179 |
+
.serverless/
|
180 |
+
|
181 |
+
# FuseBox cache
|
182 |
+
.fusebox/
|
183 |
+
|
184 |
+
# DynamoDB Local files
|
185 |
+
.dynamodb/
|
186 |
+
|
187 |
+
# TernJS port file
|
188 |
+
.tern-port
|
189 |
+
|
190 |
+
# Stores VSCode versions used for testing VSCode extensions
|
191 |
+
.vscode-test
|
192 |
+
|
193 |
+
# yarn v2
|
194 |
+
.yarn/cache
|
195 |
+
.yarn/unplugged
|
196 |
+
.yarn/build-state.yml
|
197 |
+
.yarn/install-state.gz
|
198 |
+
.pnp.*
|
199 |
+
## .gitignore.d/Node.gitignore END
|
200 |
+
## .gitignore.d/Python.gitignore START
|
201 |
+
# Byte-compiled / optimized / DLL files
|
202 |
+
__pycache__/
|
203 |
+
*.py[cod]
|
204 |
+
*$py.class
|
205 |
+
|
206 |
+
# C extensions
|
207 |
+
*.so
|
208 |
+
|
209 |
+
# Distribution / packaging
|
210 |
+
.Python
|
211 |
+
build/
|
212 |
+
develop-eggs/
|
213 |
+
dist/
|
214 |
+
downloads/
|
215 |
+
eggs/
|
216 |
+
.eggs/
|
217 |
+
# lib/
|
218 |
+
lib64/
|
219 |
+
parts/
|
220 |
+
sdist/
|
221 |
+
var/
|
222 |
+
wheels/
|
223 |
+
share/python-wheels/
|
224 |
+
*.egg-info/
|
225 |
+
.installed.cfg
|
226 |
+
*.egg
|
227 |
+
MANIFEST
|
228 |
+
|
229 |
+
# PyInstaller
|
230 |
+
# Usually these files are written by a python script from a template
|
231 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
232 |
+
*.manifest
|
233 |
+
*.spec
|
234 |
+
|
235 |
+
# Installer logs
|
236 |
+
pip-log.txt
|
237 |
+
pip-delete-this-directory.txt
|
238 |
+
|
239 |
+
# Unit test / coverage reports
|
240 |
+
htmlcov/
|
241 |
+
.tox/
|
242 |
+
.nox/
|
243 |
+
.coverage
|
244 |
+
.coverage.*
|
245 |
+
.cache
|
246 |
+
nosetests.xml
|
247 |
+
coverage.xml
|
248 |
+
*.cover
|
249 |
+
*.py,cover
|
250 |
+
.hypothesis/
|
251 |
+
.pytest_cache/
|
252 |
+
cover/
|
253 |
+
|
254 |
+
# Translations
|
255 |
+
*.mo
|
256 |
+
*.pot
|
257 |
+
|
258 |
+
# Django stuff:
|
259 |
+
*.log
|
260 |
+
local_settings.py
|
261 |
+
db.sqlite3
|
262 |
+
db.sqlite3-journal
|
263 |
+
|
264 |
+
# Flask stuff:
|
265 |
+
instance/
|
266 |
+
.webassets-cache
|
267 |
+
|
268 |
+
# Scrapy stuff:
|
269 |
+
.scrapy
|
270 |
+
|
271 |
+
# Sphinx documentation
|
272 |
+
docs/_build/
|
273 |
+
|
274 |
+
# PyBuilder
|
275 |
+
.pybuilder/
|
276 |
+
target/
|
277 |
+
|
278 |
+
# Jupyter Notebook
|
279 |
+
.ipynb_checkpoints
|
280 |
+
|
281 |
+
# IPython
|
282 |
+
profile_default/
|
283 |
+
ipython_config.py
|
284 |
+
|
285 |
+
# pyenv
|
286 |
+
# For a library or package, you might want to ignore these files since the code is
|
287 |
+
# intended to run in multiple environments; otherwise, check them in:
|
288 |
+
# .python-version
|
289 |
+
|
290 |
+
# pipenv
|
291 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
292 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
293 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
294 |
+
# install all needed dependencies.
|
295 |
+
#Pipfile.lock
|
296 |
+
|
297 |
+
# poetry
|
298 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
299 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
300 |
+
# commonly ignored for libraries.
|
301 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
302 |
+
#poetry.lock
|
303 |
+
|
304 |
+
# pdm
|
305 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
306 |
+
#pdm.lock
|
307 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
308 |
+
# in version control.
|
309 |
+
# https://pdm.fming.dev/#use-with-ide
|
310 |
+
.pdm.toml
|
311 |
+
|
312 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
313 |
+
__pypackages__/
|
314 |
+
|
315 |
+
# Celery stuff
|
316 |
+
celerybeat-schedule
|
317 |
+
celerybeat.pid
|
318 |
+
|
319 |
+
# SageMath parsed files
|
320 |
+
*.sage.py
|
321 |
+
|
322 |
+
# Environments
|
323 |
+
.env
|
324 |
+
.venv
|
325 |
+
env/
|
326 |
+
venv/
|
327 |
+
ENV/
|
328 |
+
env.bak/
|
329 |
+
venv.bak/
|
330 |
+
|
331 |
+
# Spyder project settings
|
332 |
+
.spyderproject
|
333 |
+
.spyproject
|
334 |
+
|
335 |
+
# Rope project settings
|
336 |
+
.ropeproject
|
337 |
+
|
338 |
+
# mkdocs documentation
|
339 |
+
/site
|
340 |
+
|
341 |
+
# mypy
|
342 |
+
.mypy_cache/
|
343 |
+
.dmypy.json
|
344 |
+
dmypy.json
|
345 |
+
|
346 |
+
# Pyre type checker
|
347 |
+
.pyre/
|
348 |
+
|
349 |
+
# pytype static type analyzer
|
350 |
+
.pytype/
|
351 |
+
|
352 |
+
# Cython debug symbols
|
353 |
+
cython_debug/
|
354 |
+
|
355 |
+
# PyCharm
|
356 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
357 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
358 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
359 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
360 |
+
#.idea/
|
361 |
+
## .gitignore.d/Python.gitignore END
|
362 |
+
## .gitignore.d/Tags.gitignore START
|
363 |
+
# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
|
364 |
+
TAGS
|
365 |
+
.TAGS
|
366 |
+
!TAGS/
|
367 |
+
tags
|
368 |
+
.tags
|
369 |
+
!tags/
|
370 |
+
gtags.files
|
371 |
+
GTAGS
|
372 |
+
GRTAGS
|
373 |
+
GPATH
|
374 |
+
GSYMS
|
375 |
+
cscope.files
|
376 |
+
cscope.out
|
377 |
+
cscope.in.out
|
378 |
+
cscope.po.out
|
379 |
+
## .gitignore.d/Tags.gitignore END
|
380 |
+
## .gitignore.d/Terraform.gitignore START
|
381 |
+
# Local .terraform directories
|
382 |
+
**/.terraform/*
|
383 |
+
|
384 |
+
# .tfstate files
|
385 |
+
*.tfstate
|
386 |
+
*.tfstate.*
|
387 |
+
|
388 |
+
# Crash log files
|
389 |
+
crash.log
|
390 |
+
crash.*.log
|
391 |
+
|
392 |
+
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
|
393 |
+
# password, private keys, and other secrets. These should not be part of version
|
394 |
+
# control as they are data points which are potentially sensitive and subject
|
395 |
+
# to change depending on the environment.
|
396 |
+
*.tfvars
|
397 |
+
*.tfvars.json
|
398 |
+
|
399 |
+
# Ignore override files as they are usually used to override resources locally and so
|
400 |
+
# are not checked in
|
401 |
+
override.tf
|
402 |
+
override.tf.json
|
403 |
+
*_override.tf
|
404 |
+
*_override.tf.json
|
405 |
+
|
406 |
+
# Include override files you do wish to add to version control using negated pattern
|
407 |
+
# !example_override.tf
|
408 |
+
|
409 |
+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
|
410 |
+
# example: *tfplan*
|
411 |
+
|
412 |
+
# Ignore CLI configuration files
|
413 |
+
.terraformrc
|
414 |
+
terraform.rc
|
415 |
+
## .gitignore.d/Terraform.gitignore END
|
416 |
+
## .gitignore.d/Vim.gitignore START
|
417 |
+
# Swap
|
418 |
+
[._]*.s[a-v][a-z]
|
419 |
+
!*.svg # comment out if you don't need vector files
|
420 |
+
[._]*.sw[a-p]
|
421 |
+
[._]s[a-rt-v][a-z]
|
422 |
+
[._]ss[a-gi-z]
|
423 |
+
[._]sw[a-p]
|
424 |
+
|
425 |
+
# Session
|
426 |
+
Session.vim
|
427 |
+
Sessionx.vim
|
428 |
+
|
429 |
+
# Temporary
|
430 |
+
.netrwhist
|
431 |
+
*~
|
432 |
+
# Auto-generated tag files
|
433 |
+
tags
|
434 |
+
# Persistent undo
|
435 |
+
[._]*.un~
|
436 |
+
## .gitignore.d/Vim.gitignore END
|
437 |
+
## .gitignore.d/VisualStudioCode.gitignore START
|
438 |
+
.vscode/*
|
439 |
+
!.vscode/settings.json
|
440 |
+
!.vscode/tasks.json
|
441 |
+
!.vscode/launch.json
|
442 |
+
!.vscode/extensions.json
|
443 |
+
!.vscode/*.code-snippets
|
444 |
+
|
445 |
+
# Local History for Visual Studio Code
|
446 |
+
.history/
|
447 |
+
|
448 |
+
# Built Visual Studio Code Extensions
|
449 |
+
*.vsix
|
450 |
+
## .gitignore.d/VisualStudioCode.gitignore END
|
451 |
+
## .gitignore.d/Windows.gitignore START
|
452 |
+
# Windows thumbnail cache files
|
453 |
+
Thumbs.db
|
454 |
+
Thumbs.db:encryptable
|
455 |
+
ehthumbs.db
|
456 |
+
ehthumbs_vista.db
|
457 |
+
|
458 |
+
# Dump file
|
459 |
+
*.stackdump
|
460 |
+
|
461 |
+
# Folder config file
|
462 |
+
[Dd]esktop.ini
|
463 |
+
|
464 |
+
# Recycle Bin used on file shares
|
465 |
+
$RECYCLE.BIN/
|
466 |
+
|
467 |
+
# Windows Installer files
|
468 |
+
*.cab
|
469 |
+
*.msi
|
470 |
+
*.msix
|
471 |
+
*.msm
|
472 |
+
*.msp
|
473 |
+
|
474 |
+
# Windows shortcuts
|
475 |
+
*.lnk
|
476 |
+
## .gitignore.d/Windows.gitignore END
|
477 |
+
## .gitignore.d/Xcode.gitignore START
|
478 |
+
## User settings
|
479 |
+
xcuserdata/
|
480 |
+
|
481 |
+
## Xcode 8 and earlier
|
482 |
+
*.xcscmblueprint
|
483 |
+
*.xccheckout
|
484 |
+
## .gitignore.d/Xcode.gitignore END
|
485 |
+
## .gitignore.d/macOS.gitignore START
|
486 |
+
# General
|
487 |
+
.DS_Store
|
488 |
+
.AppleDouble
|
489 |
+
.LSOverride
|
490 |
+
|
491 |
+
# Icon must end with two \r
|
492 |
+
Icon
|
493 |
+
|
494 |
+
|
495 |
+
# Thumbnails
|
496 |
+
._*
|
497 |
+
|
498 |
+
# Files that might appear in the root of a volume
|
499 |
+
.DocumentRevisions-V100
|
500 |
+
.fseventsd
|
501 |
+
.Spotlight-V100
|
502 |
+
.TemporaryItems
|
503 |
+
.Trashes
|
504 |
+
.VolumeIcon.icns
|
505 |
+
.com.apple.timemachine.donotpresent
|
506 |
+
|
507 |
+
# Directories potentially created on remote AFP share
|
508 |
+
.AppleDB
|
509 |
+
.AppleDesktop
|
510 |
+
Network Trash Folder
|
511 |
+
Temporary Items
|
512 |
+
.apdisk
|
513 |
+
## .gitignore.d/macOS.gitignore END
|
.gitignore.d/Archives.gitignore
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# It's better to unpack these files and commit the raw source because
|
2 |
+
# git has its own built in compression methods.
|
3 |
+
*.7z
|
4 |
+
*.jar
|
5 |
+
*.rar
|
6 |
+
*.zip
|
7 |
+
*.gz
|
8 |
+
*.gzip
|
9 |
+
*.tgz
|
10 |
+
*.bzip
|
11 |
+
*.bzip2
|
12 |
+
*.bz2
|
13 |
+
*.xz
|
14 |
+
*.lzma
|
15 |
+
*.cab
|
16 |
+
*.xar
|
17 |
+
|
18 |
+
# Packing-only formats
|
19 |
+
*.iso
|
20 |
+
*.tar
|
21 |
+
|
22 |
+
# Package management formats
|
23 |
+
*.dmg
|
24 |
+
*.xpi
|
25 |
+
*.gem
|
26 |
+
*.egg
|
27 |
+
*.deb
|
28 |
+
*.rpm
|
29 |
+
*.msi
|
30 |
+
*.msm
|
31 |
+
*.msp
|
32 |
+
*.txz
|
.gitignore.d/Backup.gitignore
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.bak
|
2 |
+
*.gho
|
3 |
+
*.ori
|
4 |
+
*.orig
|
5 |
+
*.tmp
|
.gitignore.d/GPG.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
secring.*
|
.gitignore.d/Linux.gitignore
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*~
|
2 |
+
|
3 |
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
4 |
+
.fuse_hidden*
|
5 |
+
|
6 |
+
# KDE directory preferences
|
7 |
+
.directory
|
8 |
+
|
9 |
+
# Linux trash folder which might appear on any partition or disk
|
10 |
+
.Trash-*
|
11 |
+
|
12 |
+
# .nfs files are created when an open file is removed but is still being accessed
|
13 |
+
.nfs*
|
.gitignore.d/Local.gitignore
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
tmp
|
2 |
+
.ruff_cache
|
3 |
+
**/__pycache__
|
4 |
+
|
5 |
+
backend_vespa/multilingual-e5-*/*
|
6 |
+
backend_vespa/multilingual-e5-*-quantized/*
|
.gitignore.d/Node.gitignore
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Logs
|
2 |
+
logs
|
3 |
+
*.log
|
4 |
+
npm-debug.log*
|
5 |
+
yarn-debug.log*
|
6 |
+
yarn-error.log*
|
7 |
+
lerna-debug.log*
|
8 |
+
.pnpm-debug.log*
|
9 |
+
|
10 |
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
11 |
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
12 |
+
|
13 |
+
# Runtime data
|
14 |
+
pids
|
15 |
+
*.pid
|
16 |
+
*.seed
|
17 |
+
*.pid.lock
|
18 |
+
|
19 |
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
20 |
+
lib-cov
|
21 |
+
|
22 |
+
# Coverage directory used by tools like istanbul
|
23 |
+
coverage
|
24 |
+
*.lcov
|
25 |
+
|
26 |
+
# nyc test coverage
|
27 |
+
.nyc_output
|
28 |
+
|
29 |
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
30 |
+
.grunt
|
31 |
+
|
32 |
+
# Bower dependency directory (https://bower.io/)
|
33 |
+
bower_components
|
34 |
+
|
35 |
+
# node-waf configuration
|
36 |
+
.lock-wscript
|
37 |
+
|
38 |
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
39 |
+
build/Release
|
40 |
+
|
41 |
+
# Dependency directories
|
42 |
+
node_modules/
|
43 |
+
jspm_packages/
|
44 |
+
|
45 |
+
# Snowpack dependency directory (https://snowpack.dev/)
|
46 |
+
web_modules/
|
47 |
+
|
48 |
+
# TypeScript cache
|
49 |
+
*.tsbuildinfo
|
50 |
+
|
51 |
+
# Optional npm cache directory
|
52 |
+
.npm
|
53 |
+
|
54 |
+
# Optional eslint cache
|
55 |
+
.eslintcache
|
56 |
+
|
57 |
+
# Optional stylelint cache
|
58 |
+
.stylelintcache
|
59 |
+
|
60 |
+
# Microbundle cache
|
61 |
+
.rpt2_cache/
|
62 |
+
.rts2_cache_cjs/
|
63 |
+
.rts2_cache_es/
|
64 |
+
.rts2_cache_umd/
|
65 |
+
|
66 |
+
# Optional REPL history
|
67 |
+
.node_repl_history
|
68 |
+
|
69 |
+
# Output of 'npm pack'
|
70 |
+
*.tgz
|
71 |
+
|
72 |
+
# Yarn Integrity file
|
73 |
+
.yarn-integrity
|
74 |
+
|
75 |
+
# dotenv environment variable files
|
76 |
+
# .env
|
77 |
+
.env.development.local
|
78 |
+
.env.test.local
|
79 |
+
.env.production.local
|
80 |
+
.env.local
|
81 |
+
|
82 |
+
# parcel-bundler cache (https://parceljs.org/)
|
83 |
+
.cache
|
84 |
+
.parcel-cache
|
85 |
+
|
86 |
+
# Next.js build output
|
87 |
+
.next
|
88 |
+
out
|
89 |
+
|
90 |
+
# Nuxt.js build / generate output
|
91 |
+
.nuxt
|
92 |
+
dist
|
93 |
+
|
94 |
+
# Gatsby files
|
95 |
+
.cache/
|
96 |
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
97 |
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
98 |
+
# public
|
99 |
+
|
100 |
+
# vuepress build output
|
101 |
+
.vuepress/dist
|
102 |
+
|
103 |
+
# vuepress v2.x temp and cache directory
|
104 |
+
.temp
|
105 |
+
.cache
|
106 |
+
|
107 |
+
# Docusaurus cache and generated files
|
108 |
+
.docusaurus
|
109 |
+
|
110 |
+
# Serverless directories
|
111 |
+
.serverless/
|
112 |
+
|
113 |
+
# FuseBox cache
|
114 |
+
.fusebox/
|
115 |
+
|
116 |
+
# DynamoDB Local files
|
117 |
+
.dynamodb/
|
118 |
+
|
119 |
+
# TernJS port file
|
120 |
+
.tern-port
|
121 |
+
|
122 |
+
# Stores VSCode versions used for testing VSCode extensions
|
123 |
+
.vscode-test
|
124 |
+
|
125 |
+
# yarn v2
|
126 |
+
.yarn/cache
|
127 |
+
.yarn/unplugged
|
128 |
+
.yarn/build-state.yml
|
129 |
+
.yarn/install-state.gz
|
130 |
+
.pnp.*
|
.gitignore.d/Python.gitignore
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Byte-compiled / optimized / DLL files
|
2 |
+
__pycache__/
|
3 |
+
*.py[cod]
|
4 |
+
*$py.class
|
5 |
+
|
6 |
+
# C extensions
|
7 |
+
*.so
|
8 |
+
|
9 |
+
# Distribution / packaging
|
10 |
+
.Python
|
11 |
+
build/
|
12 |
+
develop-eggs/
|
13 |
+
dist/
|
14 |
+
downloads/
|
15 |
+
eggs/
|
16 |
+
.eggs/
|
17 |
+
# lib/
|
18 |
+
lib64/
|
19 |
+
parts/
|
20 |
+
sdist/
|
21 |
+
var/
|
22 |
+
wheels/
|
23 |
+
share/python-wheels/
|
24 |
+
*.egg-info/
|
25 |
+
.installed.cfg
|
26 |
+
*.egg
|
27 |
+
MANIFEST
|
28 |
+
|
29 |
+
# PyInstaller
|
30 |
+
# Usually these files are written by a python script from a template
|
31 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
32 |
+
*.manifest
|
33 |
+
*.spec
|
34 |
+
|
35 |
+
# Installer logs
|
36 |
+
pip-log.txt
|
37 |
+
pip-delete-this-directory.txt
|
38 |
+
|
39 |
+
# Unit test / coverage reports
|
40 |
+
htmlcov/
|
41 |
+
.tox/
|
42 |
+
.nox/
|
43 |
+
.coverage
|
44 |
+
.coverage.*
|
45 |
+
.cache
|
46 |
+
nosetests.xml
|
47 |
+
coverage.xml
|
48 |
+
*.cover
|
49 |
+
*.py,cover
|
50 |
+
.hypothesis/
|
51 |
+
.pytest_cache/
|
52 |
+
cover/
|
53 |
+
|
54 |
+
# Translations
|
55 |
+
*.mo
|
56 |
+
*.pot
|
57 |
+
|
58 |
+
# Django stuff:
|
59 |
+
*.log
|
60 |
+
local_settings.py
|
61 |
+
db.sqlite3
|
62 |
+
db.sqlite3-journal
|
63 |
+
|
64 |
+
# Flask stuff:
|
65 |
+
instance/
|
66 |
+
.webassets-cache
|
67 |
+
|
68 |
+
# Scrapy stuff:
|
69 |
+
.scrapy
|
70 |
+
|
71 |
+
# Sphinx documentation
|
72 |
+
docs/_build/
|
73 |
+
|
74 |
+
# PyBuilder
|
75 |
+
.pybuilder/
|
76 |
+
target/
|
77 |
+
|
78 |
+
# Jupyter Notebook
|
79 |
+
.ipynb_checkpoints
|
80 |
+
|
81 |
+
# IPython
|
82 |
+
profile_default/
|
83 |
+
ipython_config.py
|
84 |
+
|
85 |
+
# pyenv
|
86 |
+
# For a library or package, you might want to ignore these files since the code is
|
87 |
+
# intended to run in multiple environments; otherwise, check them in:
|
88 |
+
# .python-version
|
89 |
+
|
90 |
+
# pipenv
|
91 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
92 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
93 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
94 |
+
# install all needed dependencies.
|
95 |
+
#Pipfile.lock
|
96 |
+
|
97 |
+
# poetry
|
98 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
99 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
100 |
+
# commonly ignored for libraries.
|
101 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
102 |
+
#poetry.lock
|
103 |
+
|
104 |
+
# pdm
|
105 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
106 |
+
#pdm.lock
|
107 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
108 |
+
# in version control.
|
109 |
+
# https://pdm.fming.dev/#use-with-ide
|
110 |
+
.pdm.toml
|
111 |
+
|
112 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
113 |
+
__pypackages__/
|
114 |
+
|
115 |
+
# Celery stuff
|
116 |
+
celerybeat-schedule
|
117 |
+
celerybeat.pid
|
118 |
+
|
119 |
+
# SageMath parsed files
|
120 |
+
*.sage.py
|
121 |
+
|
122 |
+
# Environments
|
123 |
+
.env
|
124 |
+
.venv
|
125 |
+
env/
|
126 |
+
venv/
|
127 |
+
ENV/
|
128 |
+
env.bak/
|
129 |
+
venv.bak/
|
130 |
+
|
131 |
+
# Spyder project settings
|
132 |
+
.spyderproject
|
133 |
+
.spyproject
|
134 |
+
|
135 |
+
# Rope project settings
|
136 |
+
.ropeproject
|
137 |
+
|
138 |
+
# mkdocs documentation
|
139 |
+
/site
|
140 |
+
|
141 |
+
# mypy
|
142 |
+
.mypy_cache/
|
143 |
+
.dmypy.json
|
144 |
+
dmypy.json
|
145 |
+
|
146 |
+
# Pyre type checker
|
147 |
+
.pyre/
|
148 |
+
|
149 |
+
# pytype static type analyzer
|
150 |
+
.pytype/
|
151 |
+
|
152 |
+
# Cython debug symbols
|
153 |
+
cython_debug/
|
154 |
+
|
155 |
+
# PyCharm
|
156 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
157 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
158 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
159 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
160 |
+
#.idea/
|
.gitignore.d/Tags.gitignore
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
|
2 |
+
TAGS
|
3 |
+
.TAGS
|
4 |
+
!TAGS/
|
5 |
+
tags
|
6 |
+
.tags
|
7 |
+
!tags/
|
8 |
+
gtags.files
|
9 |
+
GTAGS
|
10 |
+
GRTAGS
|
11 |
+
GPATH
|
12 |
+
GSYMS
|
13 |
+
cscope.files
|
14 |
+
cscope.out
|
15 |
+
cscope.in.out
|
16 |
+
cscope.po.out
|
.gitignore.d/Terraform.gitignore
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Local .terraform directories
|
2 |
+
**/.terraform/*
|
3 |
+
|
4 |
+
# .tfstate files
|
5 |
+
*.tfstate
|
6 |
+
*.tfstate.*
|
7 |
+
|
8 |
+
# Crash log files
|
9 |
+
crash.log
|
10 |
+
crash.*.log
|
11 |
+
|
12 |
+
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
|
13 |
+
# password, private keys, and other secrets. These should not be part of version
|
14 |
+
# control as they are data points which are potentially sensitive and subject
|
15 |
+
# to change depending on the environment.
|
16 |
+
*.tfvars
|
17 |
+
*.tfvars.json
|
18 |
+
|
19 |
+
# Ignore override files as they are usually used to override resources locally and so
|
20 |
+
# are not checked in
|
21 |
+
override.tf
|
22 |
+
override.tf.json
|
23 |
+
*_override.tf
|
24 |
+
*_override.tf.json
|
25 |
+
|
26 |
+
# Include override files you do wish to add to version control using negated pattern
|
27 |
+
# !example_override.tf
|
28 |
+
|
29 |
+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
|
30 |
+
# example: *tfplan*
|
31 |
+
|
32 |
+
# Ignore CLI configuration files
|
33 |
+
.terraformrc
|
34 |
+
terraform.rc
|
.gitignore.d/Vim.gitignore
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Swap
|
2 |
+
[._]*.s[a-v][a-z]
|
3 |
+
!*.svg # comment out if you don't need vector files
|
4 |
+
[._]*.sw[a-p]
|
5 |
+
[._]s[a-rt-v][a-z]
|
6 |
+
[._]ss[a-gi-z]
|
7 |
+
[._]sw[a-p]
|
8 |
+
|
9 |
+
# Session
|
10 |
+
Session.vim
|
11 |
+
Sessionx.vim
|
12 |
+
|
13 |
+
# Temporary
|
14 |
+
.netrwhist
|
15 |
+
*~
|
16 |
+
# Auto-generated tag files
|
17 |
+
tags
|
18 |
+
# Persistent undo
|
19 |
+
[._]*.un~
|
.gitignore.d/VisualStudioCode.gitignore
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.vscode/*
|
2 |
+
!.vscode/settings.json
|
3 |
+
!.vscode/tasks.json
|
4 |
+
!.vscode/launch.json
|
5 |
+
!.vscode/extensions.json
|
6 |
+
!.vscode/*.code-snippets
|
7 |
+
|
8 |
+
# Local History for Visual Studio Code
|
9 |
+
.history/
|
10 |
+
|
11 |
+
# Built Visual Studio Code Extensions
|
12 |
+
*.vsix
|
.gitignore.d/Windows.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Windows thumbnail cache files
|
2 |
+
Thumbs.db
|
3 |
+
Thumbs.db:encryptable
|
4 |
+
ehthumbs.db
|
5 |
+
ehthumbs_vista.db
|
6 |
+
|
7 |
+
# Dump file
|
8 |
+
*.stackdump
|
9 |
+
|
10 |
+
# Folder config file
|
11 |
+
[Dd]esktop.ini
|
12 |
+
|
13 |
+
# Recycle Bin used on file shares
|
14 |
+
$RECYCLE.BIN/
|
15 |
+
|
16 |
+
# Windows Installer files
|
17 |
+
*.cab
|
18 |
+
*.msi
|
19 |
+
*.msix
|
20 |
+
*.msm
|
21 |
+
*.msp
|
22 |
+
|
23 |
+
# Windows shortcuts
|
24 |
+
*.lnk
|
.gitignore.d/Xcode.gitignore
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## User settings
|
2 |
+
xcuserdata/
|
3 |
+
|
4 |
+
## Xcode 8 and earlier
|
5 |
+
*.xcscmblueprint
|
6 |
+
*.xccheckout
|
.gitignore.d/macOS.gitignore
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# General
|
2 |
+
.DS_Store
|
3 |
+
.AppleDouble
|
4 |
+
.LSOverride
|
5 |
+
|
6 |
+
# Icon must end with two \r
|
7 |
+
Icon
|
8 |
+
|
9 |
+
|
10 |
+
# Thumbnails
|
11 |
+
._*
|
12 |
+
|
13 |
+
# Files that might appear in the root of a volume
|
14 |
+
.DocumentRevisions-V100
|
15 |
+
.fseventsd
|
16 |
+
.Spotlight-V100
|
17 |
+
.TemporaryItems
|
18 |
+
.Trashes
|
19 |
+
.VolumeIcon.icns
|
20 |
+
.com.apple.timemachine.donotpresent
|
21 |
+
|
22 |
+
# Directories potentially created on remote AFP share
|
23 |
+
.AppleDB
|
24 |
+
.AppleDesktop
|
25 |
+
Network Trash Folder
|
26 |
+
Temporary Items
|
27 |
+
.apdisk
|
.lfsconfig
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
[lfs]
|
2 |
+
url = https://huggingface.co/spaces/hicustomer/govsearch.git/info/lfs
|
.node-version
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
20.12.1
|
.npmrc
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
save-exact=true
|
.python-version
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
3.10.13
|
Dockerfile
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM node:20.12.1 as frontend
|
2 |
+
WORKDIR /app
|
3 |
+
|
4 |
+
RUN --mount=type=bind,source=package-lock.json,target=package-lock.json \
|
5 |
+
--mount=type=bind,source=package.json,target=package.json \
|
6 |
+
--mount=type=bind,source=.npmrc,target=.npmrc \
|
7 |
+
npm ci
|
8 |
+
|
9 |
+
COPY . /app
|
10 |
+
|
11 |
+
RUN make build_frontend
|
12 |
+
|
13 |
+
|
14 |
+
FROM library/maven:3.9.6-eclipse-temurin-17-focal as backend_vespa
|
15 |
+
WORKDIR /app
|
16 |
+
|
17 |
+
RUN apt-get update && apt-get install -y --no-install-recommends build-essential
|
18 |
+
|
19 |
+
COPY ./backend_vespa /app
|
20 |
+
|
21 |
+
RUN make package
|
22 |
+
|
23 |
+
|
24 |
+
FROM vespaengine/vespa:8.324.16
|
25 |
+
|
26 |
+
USER root
|
27 |
+
RUN chown vespa:vespa /opt/vespa && rm /etc/yum.repos.d/epel.repo
|
28 |
+
|
29 |
+
ENV HOME=/opt/vespa
|
30 |
+
ENV RYE_HOME="$HOME/.rye"
|
31 |
+
ENV PATH="$HOME/app/.venv/bin:$RYE_HOME/shims:$HOME/.local/bin:$PATH"
|
32 |
+
USER vespa
|
33 |
+
WORKDIR $HOME/app
|
34 |
+
|
35 |
+
RUN curl -sSf https://rye-up.com/get | \
|
36 |
+
RYE_NO_AUTO_INSTALL=1 RYE_INSTALL_OPTION="--yes" bash
|
37 |
+
RUN --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
38 |
+
--mount=type=bind,source=requirements.lock,target=requirements.lock \
|
39 |
+
--mount=type=bind,source=requirements-dev.lock,target=requirements-dev.lock \
|
40 |
+
--mount=type=bind,source=.python-version,target=.python-version \
|
41 |
+
--mount=type=bind,source=README.md,target=README.md \
|
42 |
+
rye sync --no-dev --no-lock
|
43 |
+
|
44 |
+
COPY --chown=vespa . $HOME/app
|
45 |
+
COPY --chown=vespa --from=frontend /app/build $HOME/app/build
|
46 |
+
COPY --chown=vespa --from=backend_vespa /app/target $HOME/app/backend_vespa/target
|
47 |
+
|
48 |
+
ENTRYPOINT ["scripts/start-container.sh"]
|
LICENSE.txt
ADDED
@@ -0,0 +1,661 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 19 November 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU Affero General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works, specifically designed to ensure
|
12 |
+
cooperation with the community in the case of network server software.
|
13 |
+
|
14 |
+
The licenses for most software and other practical works are designed
|
15 |
+
to take away your freedom to share and change the works. By contrast,
|
16 |
+
our General Public Licenses are intended to guarantee your freedom to
|
17 |
+
share and change all versions of a program--to make sure it remains free
|
18 |
+
software for all its users.
|
19 |
+
|
20 |
+
When we speak of free software, we are referring to freedom, not
|
21 |
+
price. Our General Public Licenses are designed to make sure that you
|
22 |
+
have the freedom to distribute copies of free software (and charge for
|
23 |
+
them if you wish), that you receive source code or can get it if you
|
24 |
+
want it, that you can change the software or use pieces of it in new
|
25 |
+
free programs, and that you know you can do these things.
|
26 |
+
|
27 |
+
Developers that use our General Public Licenses protect your rights
|
28 |
+
with two steps: (1) assert copyright on the software, and (2) offer
|
29 |
+
you this License which gives you legal permission to copy, distribute
|
30 |
+
and/or modify the software.
|
31 |
+
|
32 |
+
A secondary benefit of defending all users' freedom is that
|
33 |
+
improvements made in alternate versions of the program, if they
|
34 |
+
receive widespread use, become available for other developers to
|
35 |
+
incorporate. Many developers of free software are heartened and
|
36 |
+
encouraged by the resulting cooperation. However, in the case of
|
37 |
+
software used on network servers, this result may fail to come about.
|
38 |
+
The GNU General Public License permits making a modified version and
|
39 |
+
letting the public access it on a server without ever releasing its
|
40 |
+
source code to the public.
|
41 |
+
|
42 |
+
The GNU Affero General Public License is designed specifically to
|
43 |
+
ensure that, in such cases, the modified source code becomes available
|
44 |
+
to the community. It requires the operator of a network server to
|
45 |
+
provide the source code of the modified version running there to the
|
46 |
+
users of that server. Therefore, public use of a modified version, on
|
47 |
+
a publicly accessible server, gives the public access to the source
|
48 |
+
code of the modified version.
|
49 |
+
|
50 |
+
An older license, called the Affero General Public License and
|
51 |
+
published by Affero, was designed to accomplish similar goals. This is
|
52 |
+
a different license, not a version of the Affero GPL, but Affero has
|
53 |
+
released a new version of the Affero GPL which permits relicensing under
|
54 |
+
this license.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
TERMS AND CONDITIONS
|
60 |
+
|
61 |
+
0. Definitions.
|
62 |
+
|
63 |
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
64 |
+
|
65 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
66 |
+
works, such as semiconductor masks.
|
67 |
+
|
68 |
+
"The Program" refers to any copyrightable work licensed under this
|
69 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
70 |
+
"recipients" may be individuals or organizations.
|
71 |
+
|
72 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
73 |
+
in a fashion requiring copyright permission, other than the making of an
|
74 |
+
exact copy. The resulting work is called a "modified version" of the
|
75 |
+
earlier work or a work "based on" the earlier work.
|
76 |
+
|
77 |
+
A "covered work" means either the unmodified Program or a work based
|
78 |
+
on the Program.
|
79 |
+
|
80 |
+
To "propagate" a work means to do anything with it that, without
|
81 |
+
permission, would make you directly or secondarily liable for
|
82 |
+
infringement under applicable copyright law, except executing it on a
|
83 |
+
computer or modifying a private copy. Propagation includes copying,
|
84 |
+
distribution (with or without modification), making available to the
|
85 |
+
public, and in some countries other activities as well.
|
86 |
+
|
87 |
+
To "convey" a work means any kind of propagation that enables other
|
88 |
+
parties to make or receive copies. Mere interaction with a user through
|
89 |
+
a computer network, with no transfer of a copy, is not conveying.
|
90 |
+
|
91 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
92 |
+
to the extent that it includes a convenient and prominently visible
|
93 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
94 |
+
tells the user that there is no warranty for the work (except to the
|
95 |
+
extent that warranties are provided), that licensees may convey the
|
96 |
+
work under this License, and how to view a copy of this License. If
|
97 |
+
the interface presents a list of user commands or options, such as a
|
98 |
+
menu, a prominent item in the list meets this criterion.
|
99 |
+
|
100 |
+
1. Source Code.
|
101 |
+
|
102 |
+
The "source code" for a work means the preferred form of the work
|
103 |
+
for making modifications to it. "Object code" means any non-source
|
104 |
+
form of a work.
|
105 |
+
|
106 |
+
A "Standard Interface" means an interface that either is an official
|
107 |
+
standard defined by a recognized standards body, or, in the case of
|
108 |
+
interfaces specified for a particular programming language, one that
|
109 |
+
is widely used among developers working in that language.
|
110 |
+
|
111 |
+
The "System Libraries" of an executable work include anything, other
|
112 |
+
than the work as a whole, that (a) is included in the normal form of
|
113 |
+
packaging a Major Component, but which is not part of that Major
|
114 |
+
Component, and (b) serves only to enable use of the work with that
|
115 |
+
Major Component, or to implement a Standard Interface for which an
|
116 |
+
implementation is available to the public in source code form. A
|
117 |
+
"Major Component", in this context, means a major essential component
|
118 |
+
(kernel, window system, and so on) of the specific operating system
|
119 |
+
(if any) on which the executable work runs, or a compiler used to
|
120 |
+
produce the work, or an object code interpreter used to run it.
|
121 |
+
|
122 |
+
The "Corresponding Source" for a work in object code form means all
|
123 |
+
the source code needed to generate, install, and (for an executable
|
124 |
+
work) run the object code and to modify the work, including scripts to
|
125 |
+
control those activities. However, it does not include the work's
|
126 |
+
System Libraries, or general-purpose tools or generally available free
|
127 |
+
programs which are used unmodified in performing those activities but
|
128 |
+
which are not part of the work. For example, Corresponding Source
|
129 |
+
includes interface definition files associated with source files for
|
130 |
+
the work, and the source code for shared libraries and dynamically
|
131 |
+
linked subprograms that the work is specifically designed to require,
|
132 |
+
such as by intimate data communication or control flow between those
|
133 |
+
subprograms and other parts of the work.
|
134 |
+
|
135 |
+
The Corresponding Source need not include anything that users
|
136 |
+
can regenerate automatically from other parts of the Corresponding
|
137 |
+
Source.
|
138 |
+
|
139 |
+
The Corresponding Source for a work in source code form is that
|
140 |
+
same work.
|
141 |
+
|
142 |
+
2. Basic Permissions.
|
143 |
+
|
144 |
+
All rights granted under this License are granted for the term of
|
145 |
+
copyright on the Program, and are irrevocable provided the stated
|
146 |
+
conditions are met. This License explicitly affirms your unlimited
|
147 |
+
permission to run the unmodified Program. The output from running a
|
148 |
+
covered work is covered by this License only if the output, given its
|
149 |
+
content, constitutes a covered work. This License acknowledges your
|
150 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
151 |
+
|
152 |
+
You may make, run and propagate covered works that you do not
|
153 |
+
convey, without conditions so long as your license otherwise remains
|
154 |
+
in force. You may convey covered works to others for the sole purpose
|
155 |
+
of having them make modifications exclusively for you, or provide you
|
156 |
+
with facilities for running those works, provided that you comply with
|
157 |
+
the terms of this License in conveying all material for which you do
|
158 |
+
not control copyright. Those thus making or running the covered works
|
159 |
+
for you must do so exclusively on your behalf, under your direction
|
160 |
+
and control, on terms that prohibit them from making any copies of
|
161 |
+
your copyrighted material outside their relationship with you.
|
162 |
+
|
163 |
+
Conveying under any other circumstances is permitted solely under
|
164 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
165 |
+
makes it unnecessary.
|
166 |
+
|
167 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
168 |
+
|
169 |
+
No covered work shall be deemed part of an effective technological
|
170 |
+
measure under any applicable law fulfilling obligations under article
|
171 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
172 |
+
similar laws prohibiting or restricting circumvention of such
|
173 |
+
measures.
|
174 |
+
|
175 |
+
When you convey a covered work, you waive any legal power to forbid
|
176 |
+
circumvention of technological measures to the extent such circumvention
|
177 |
+
is effected by exercising rights under this License with respect to
|
178 |
+
the covered work, and you disclaim any intention to limit operation or
|
179 |
+
modification of the work as a means of enforcing, against the work's
|
180 |
+
users, your or third parties' legal rights to forbid circumvention of
|
181 |
+
technological measures.
|
182 |
+
|
183 |
+
4. Conveying Verbatim Copies.
|
184 |
+
|
185 |
+
You may convey verbatim copies of the Program's source code as you
|
186 |
+
receive it, in any medium, provided that you conspicuously and
|
187 |
+
appropriately publish on each copy an appropriate copyright notice;
|
188 |
+
keep intact all notices stating that this License and any
|
189 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
190 |
+
keep intact all notices of the absence of any warranty; and give all
|
191 |
+
recipients a copy of this License along with the Program.
|
192 |
+
|
193 |
+
You may charge any price or no price for each copy that you convey,
|
194 |
+
and you may offer support or warranty protection for a fee.
|
195 |
+
|
196 |
+
5. Conveying Modified Source Versions.
|
197 |
+
|
198 |
+
You may convey a work based on the Program, or the modifications to
|
199 |
+
produce it from the Program, in the form of source code under the
|
200 |
+
terms of section 4, provided that you also meet all of these conditions:
|
201 |
+
|
202 |
+
a) The work must carry prominent notices stating that you modified
|
203 |
+
it, and giving a relevant date.
|
204 |
+
|
205 |
+
b) The work must carry prominent notices stating that it is
|
206 |
+
released under this License and any conditions added under section
|
207 |
+
7. This requirement modifies the requirement in section 4 to
|
208 |
+
"keep intact all notices".
|
209 |
+
|
210 |
+
c) You must license the entire work, as a whole, under this
|
211 |
+
License to anyone who comes into possession of a copy. This
|
212 |
+
License will therefore apply, along with any applicable section 7
|
213 |
+
additional terms, to the whole of the work, and all its parts,
|
214 |
+
regardless of how they are packaged. This License gives no
|
215 |
+
permission to license the work in any other way, but it does not
|
216 |
+
invalidate such permission if you have separately received it.
|
217 |
+
|
218 |
+
d) If the work has interactive user interfaces, each must display
|
219 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
220 |
+
interfaces that do not display Appropriate Legal Notices, your
|
221 |
+
work need not make them do so.
|
222 |
+
|
223 |
+
A compilation of a covered work with other separate and independent
|
224 |
+
works, which are not by their nature extensions of the covered work,
|
225 |
+
and which are not combined with it such as to form a larger program,
|
226 |
+
in or on a volume of a storage or distribution medium, is called an
|
227 |
+
"aggregate" if the compilation and its resulting copyright are not
|
228 |
+
used to limit the access or legal rights of the compilation's users
|
229 |
+
beyond what the individual works permit. Inclusion of a covered work
|
230 |
+
in an aggregate does not cause this License to apply to the other
|
231 |
+
parts of the aggregate.
|
232 |
+
|
233 |
+
6. Conveying Non-Source Forms.
|
234 |
+
|
235 |
+
You may convey a covered work in object code form under the terms
|
236 |
+
of sections 4 and 5, provided that you also convey the
|
237 |
+
machine-readable Corresponding Source under the terms of this License,
|
238 |
+
in one of these ways:
|
239 |
+
|
240 |
+
a) Convey the object code in, or embodied in, a physical product
|
241 |
+
(including a physical distribution medium), accompanied by the
|
242 |
+
Corresponding Source fixed on a durable physical medium
|
243 |
+
customarily used for software interchange.
|
244 |
+
|
245 |
+
b) Convey the object code in, or embodied in, a physical product
|
246 |
+
(including a physical distribution medium), accompanied by a
|
247 |
+
written offer, valid for at least three years and valid for as
|
248 |
+
long as you offer spare parts or customer support for that product
|
249 |
+
model, to give anyone who possesses the object code either (1) a
|
250 |
+
copy of the Corresponding Source for all the software in the
|
251 |
+
product that is covered by this License, on a durable physical
|
252 |
+
medium customarily used for software interchange, for a price no
|
253 |
+
more than your reasonable cost of physically performing this
|
254 |
+
conveying of source, or (2) access to copy the
|
255 |
+
Corresponding Source from a network server at no charge.
|
256 |
+
|
257 |
+
c) Convey individual copies of the object code with a copy of the
|
258 |
+
written offer to provide the Corresponding Source. This
|
259 |
+
alternative is allowed only occasionally and noncommercially, and
|
260 |
+
only if you received the object code with such an offer, in accord
|
261 |
+
with subsection 6b.
|
262 |
+
|
263 |
+
d) Convey the object code by offering access from a designated
|
264 |
+
place (gratis or for a charge), and offer equivalent access to the
|
265 |
+
Corresponding Source in the same way through the same place at no
|
266 |
+
further charge. You need not require recipients to copy the
|
267 |
+
Corresponding Source along with the object code. If the place to
|
268 |
+
copy the object code is a network server, the Corresponding Source
|
269 |
+
may be on a different server (operated by you or a third party)
|
270 |
+
that supports equivalent copying facilities, provided you maintain
|
271 |
+
clear directions next to the object code saying where to find the
|
272 |
+
Corresponding Source. Regardless of what server hosts the
|
273 |
+
Corresponding Source, you remain obligated to ensure that it is
|
274 |
+
available for as long as needed to satisfy these requirements.
|
275 |
+
|
276 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
277 |
+
you inform other peers where the object code and Corresponding
|
278 |
+
Source of the work are being offered to the general public at no
|
279 |
+
charge under subsection 6d.
|
280 |
+
|
281 |
+
A separable portion of the object code, whose source code is excluded
|
282 |
+
from the Corresponding Source as a System Library, need not be
|
283 |
+
included in conveying the object code work.
|
284 |
+
|
285 |
+
A "User Product" is either (1) a "consumer product", which means any
|
286 |
+
tangible personal property which is normally used for personal, family,
|
287 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
288 |
+
into a dwelling. In determining whether a product is a consumer product,
|
289 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
290 |
+
product received by a particular user, "normally used" refers to a
|
291 |
+
typical or common use of that class of product, regardless of the status
|
292 |
+
of the particular user or of the way in which the particular user
|
293 |
+
actually uses, or expects or is expected to use, the product. A product
|
294 |
+
is a consumer product regardless of whether the product has substantial
|
295 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
296 |
+
the only significant mode of use of the product.
|
297 |
+
|
298 |
+
"Installation Information" for a User Product means any methods,
|
299 |
+
procedures, authorization keys, or other information required to install
|
300 |
+
and execute modified versions of a covered work in that User Product from
|
301 |
+
a modified version of its Corresponding Source. The information must
|
302 |
+
suffice to ensure that the continued functioning of the modified object
|
303 |
+
code is in no case prevented or interfered with solely because
|
304 |
+
modification has been made.
|
305 |
+
|
306 |
+
If you convey an object code work under this section in, or with, or
|
307 |
+
specifically for use in, a User Product, and the conveying occurs as
|
308 |
+
part of a transaction in which the right of possession and use of the
|
309 |
+
User Product is transferred to the recipient in perpetuity or for a
|
310 |
+
fixed term (regardless of how the transaction is characterized), the
|
311 |
+
Corresponding Source conveyed under this section must be accompanied
|
312 |
+
by the Installation Information. But this requirement does not apply
|
313 |
+
if neither you nor any third party retains the ability to install
|
314 |
+
modified object code on the User Product (for example, the work has
|
315 |
+
been installed in ROM).
|
316 |
+
|
317 |
+
The requirement to provide Installation Information does not include a
|
318 |
+
requirement to continue to provide support service, warranty, or updates
|
319 |
+
for a work that has been modified or installed by the recipient, or for
|
320 |
+
the User Product in which it has been modified or installed. Access to a
|
321 |
+
network may be denied when the modification itself materially and
|
322 |
+
adversely affects the operation of the network or violates the rules and
|
323 |
+
protocols for communication across the network.
|
324 |
+
|
325 |
+
Corresponding Source conveyed, and Installation Information provided,
|
326 |
+
in accord with this section must be in a format that is publicly
|
327 |
+
documented (and with an implementation available to the public in
|
328 |
+
source code form), and must require no special password or key for
|
329 |
+
unpacking, reading or copying.
|
330 |
+
|
331 |
+
7. Additional Terms.
|
332 |
+
|
333 |
+
"Additional permissions" are terms that supplement the terms of this
|
334 |
+
License by making exceptions from one or more of its conditions.
|
335 |
+
Additional permissions that are applicable to the entire Program shall
|
336 |
+
be treated as though they were included in this License, to the extent
|
337 |
+
that they are valid under applicable law. If additional permissions
|
338 |
+
apply only to part of the Program, that part may be used separately
|
339 |
+
under those permissions, but the entire Program remains governed by
|
340 |
+
this License without regard to the additional permissions.
|
341 |
+
|
342 |
+
When you convey a copy of a covered work, you may at your option
|
343 |
+
remove any additional permissions from that copy, or from any part of
|
344 |
+
it. (Additional permissions may be written to require their own
|
345 |
+
removal in certain cases when you modify the work.) You may place
|
346 |
+
additional permissions on material, added by you to a covered work,
|
347 |
+
for which you have or can give appropriate copyright permission.
|
348 |
+
|
349 |
+
Notwithstanding any other provision of this License, for material you
|
350 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
351 |
+
that material) supplement the terms of this License with terms:
|
352 |
+
|
353 |
+
a) Disclaiming warranty or limiting liability differently from the
|
354 |
+
terms of sections 15 and 16 of this License; or
|
355 |
+
|
356 |
+
b) Requiring preservation of specified reasonable legal notices or
|
357 |
+
author attributions in that material or in the Appropriate Legal
|
358 |
+
Notices displayed by works containing it; or
|
359 |
+
|
360 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
361 |
+
requiring that modified versions of such material be marked in
|
362 |
+
reasonable ways as different from the original version; or
|
363 |
+
|
364 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
365 |
+
authors of the material; or
|
366 |
+
|
367 |
+
e) Declining to grant rights under trademark law for use of some
|
368 |
+
trade names, trademarks, or service marks; or
|
369 |
+
|
370 |
+
f) Requiring indemnification of licensors and authors of that
|
371 |
+
material by anyone who conveys the material (or modified versions of
|
372 |
+
it) with contractual assumptions of liability to the recipient, for
|
373 |
+
any liability that these contractual assumptions directly impose on
|
374 |
+
those licensors and authors.
|
375 |
+
|
376 |
+
All other non-permissive additional terms are considered "further
|
377 |
+
restrictions" within the meaning of section 10. If the Program as you
|
378 |
+
received it, or any part of it, contains a notice stating that it is
|
379 |
+
governed by this License along with a term that is a further
|
380 |
+
restriction, you may remove that term. If a license document contains
|
381 |
+
a further restriction but permits relicensing or conveying under this
|
382 |
+
License, you may add to a covered work material governed by the terms
|
383 |
+
of that license document, provided that the further restriction does
|
384 |
+
not survive such relicensing or conveying.
|
385 |
+
|
386 |
+
If you add terms to a covered work in accord with this section, you
|
387 |
+
must place, in the relevant source files, a statement of the
|
388 |
+
additional terms that apply to those files, or a notice indicating
|
389 |
+
where to find the applicable terms.
|
390 |
+
|
391 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
392 |
+
form of a separately written license, or stated as exceptions;
|
393 |
+
the above requirements apply either way.
|
394 |
+
|
395 |
+
8. Termination.
|
396 |
+
|
397 |
+
You may not propagate or modify a covered work except as expressly
|
398 |
+
provided under this License. Any attempt otherwise to propagate or
|
399 |
+
modify it is void, and will automatically terminate your rights under
|
400 |
+
this License (including any patent licenses granted under the third
|
401 |
+
paragraph of section 11).
|
402 |
+
|
403 |
+
However, if you cease all violation of this License, then your
|
404 |
+
license from a particular copyright holder is reinstated (a)
|
405 |
+
provisionally, unless and until the copyright holder explicitly and
|
406 |
+
finally terminates your license, and (b) permanently, if the copyright
|
407 |
+
holder fails to notify you of the violation by some reasonable means
|
408 |
+
prior to 60 days after the cessation.
|
409 |
+
|
410 |
+
Moreover, your license from a particular copyright holder is
|
411 |
+
reinstated permanently if the copyright holder notifies you of the
|
412 |
+
violation by some reasonable means, this is the first time you have
|
413 |
+
received notice of violation of this License (for any work) from that
|
414 |
+
copyright holder, and you cure the violation prior to 30 days after
|
415 |
+
your receipt of the notice.
|
416 |
+
|
417 |
+
Termination of your rights under this section does not terminate the
|
418 |
+
licenses of parties who have received copies or rights from you under
|
419 |
+
this License. If your rights have been terminated and not permanently
|
420 |
+
reinstated, you do not qualify to receive new licenses for the same
|
421 |
+
material under section 10.
|
422 |
+
|
423 |
+
9. Acceptance Not Required for Having Copies.
|
424 |
+
|
425 |
+
You are not required to accept this License in order to receive or
|
426 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
427 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
428 |
+
to receive a copy likewise does not require acceptance. However,
|
429 |
+
nothing other than this License grants you permission to propagate or
|
430 |
+
modify any covered work. These actions infringe copyright if you do
|
431 |
+
not accept this License. Therefore, by modifying or propagating a
|
432 |
+
covered work, you indicate your acceptance of this License to do so.
|
433 |
+
|
434 |
+
10. Automatic Licensing of Downstream Recipients.
|
435 |
+
|
436 |
+
Each time you convey a covered work, the recipient automatically
|
437 |
+
receives a license from the original licensors, to run, modify and
|
438 |
+
propagate that work, subject to this License. You are not responsible
|
439 |
+
for enforcing compliance by third parties with this License.
|
440 |
+
|
441 |
+
An "entity transaction" is a transaction transferring control of an
|
442 |
+
organization, or substantially all assets of one, or subdividing an
|
443 |
+
organization, or merging organizations. If propagation of a covered
|
444 |
+
work results from an entity transaction, each party to that
|
445 |
+
transaction who receives a copy of the work also receives whatever
|
446 |
+
licenses to the work the party's predecessor in interest had or could
|
447 |
+
give under the previous paragraph, plus a right to possession of the
|
448 |
+
Corresponding Source of the work from the predecessor in interest, if
|
449 |
+
the predecessor has it or can get it with reasonable efforts.
|
450 |
+
|
451 |
+
You may not impose any further restrictions on the exercise of the
|
452 |
+
rights granted or affirmed under this License. For example, you may
|
453 |
+
not impose a license fee, royalty, or other charge for exercise of
|
454 |
+
rights granted under this License, and you may not initiate litigation
|
455 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
456 |
+
any patent claim is infringed by making, using, selling, offering for
|
457 |
+
sale, or importing the Program or any portion of it.
|
458 |
+
|
459 |
+
11. Patents.
|
460 |
+
|
461 |
+
A "contributor" is a copyright holder who authorizes use under this
|
462 |
+
License of the Program or a work on which the Program is based. The
|
463 |
+
work thus licensed is called the contributor's "contributor version".
|
464 |
+
|
465 |
+
A contributor's "essential patent claims" are all patent claims
|
466 |
+
owned or controlled by the contributor, whether already acquired or
|
467 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
468 |
+
by this License, of making, using, or selling its contributor version,
|
469 |
+
but do not include claims that would be infringed only as a
|
470 |
+
consequence of further modification of the contributor version. For
|
471 |
+
purposes of this definition, "control" includes the right to grant
|
472 |
+
patent sublicenses in a manner consistent with the requirements of
|
473 |
+
this License.
|
474 |
+
|
475 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
476 |
+
patent license under the contributor's essential patent claims, to
|
477 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
478 |
+
propagate the contents of its contributor version.
|
479 |
+
|
480 |
+
In the following three paragraphs, a "patent license" is any express
|
481 |
+
agreement or commitment, however denominated, not to enforce a patent
|
482 |
+
(such as an express permission to practice a patent or covenant not to
|
483 |
+
sue for patent infringement). To "grant" such a patent license to a
|
484 |
+
party means to make such an agreement or commitment not to enforce a
|
485 |
+
patent against the party.
|
486 |
+
|
487 |
+
If you convey a covered work, knowingly relying on a patent license,
|
488 |
+
and the Corresponding Source of the work is not available for anyone
|
489 |
+
to copy, free of charge and under the terms of this License, through a
|
490 |
+
publicly available network server or other readily accessible means,
|
491 |
+
then you must either (1) cause the Corresponding Source to be so
|
492 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
493 |
+
patent license for this particular work, or (3) arrange, in a manner
|
494 |
+
consistent with the requirements of this License, to extend the patent
|
495 |
+
license to downstream recipients. "Knowingly relying" means you have
|
496 |
+
actual knowledge that, but for the patent license, your conveying the
|
497 |
+
covered work in a country, or your recipient's use of the covered work
|
498 |
+
in a country, would infringe one or more identifiable patents in that
|
499 |
+
country that you have reason to believe are valid.
|
500 |
+
|
501 |
+
If, pursuant to or in connection with a single transaction or
|
502 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
503 |
+
covered work, and grant a patent license to some of the parties
|
504 |
+
receiving the covered work authorizing them to use, propagate, modify
|
505 |
+
or convey a specific copy of the covered work, then the patent license
|
506 |
+
you grant is automatically extended to all recipients of the covered
|
507 |
+
work and works based on it.
|
508 |
+
|
509 |
+
A patent license is "discriminatory" if it does not include within
|
510 |
+
the scope of its coverage, prohibits the exercise of, or is
|
511 |
+
conditioned on the non-exercise of one or more of the rights that are
|
512 |
+
specifically granted under this License. You may not convey a covered
|
513 |
+
work if you are a party to an arrangement with a third party that is
|
514 |
+
in the business of distributing software, under which you make payment
|
515 |
+
to the third party based on the extent of your activity of conveying
|
516 |
+
the work, and under which the third party grants, to any of the
|
517 |
+
parties who would receive the covered work from you, a discriminatory
|
518 |
+
patent license (a) in connection with copies of the covered work
|
519 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
520 |
+
for and in connection with specific products or compilations that
|
521 |
+
contain the covered work, unless you entered into that arrangement,
|
522 |
+
or that patent license was granted, prior to 28 March 2007.
|
523 |
+
|
524 |
+
Nothing in this License shall be construed as excluding or limiting
|
525 |
+
any implied license or other defenses to infringement that may
|
526 |
+
otherwise be available to you under applicable patent law.
|
527 |
+
|
528 |
+
12. No Surrender of Others' Freedom.
|
529 |
+
|
530 |
+
If conditions are imposed on you (whether by court order, agreement or
|
531 |
+
otherwise) that contradict the conditions of this License, they do not
|
532 |
+
excuse you from the conditions of this License. If you cannot convey a
|
533 |
+
covered work so as to satisfy simultaneously your obligations under this
|
534 |
+
License and any other pertinent obligations, then as a consequence you may
|
535 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
536 |
+
to collect a royalty for further conveying from those to whom you convey
|
537 |
+
the Program, the only way you could satisfy both those terms and this
|
538 |
+
License would be to refrain entirely from conveying the Program.
|
539 |
+
|
540 |
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
541 |
+
|
542 |
+
Notwithstanding any other provision of this License, if you modify the
|
543 |
+
Program, your modified version must prominently offer all users
|
544 |
+
interacting with it remotely through a computer network (if your version
|
545 |
+
supports such interaction) an opportunity to receive the Corresponding
|
546 |
+
Source of your version by providing access to the Corresponding Source
|
547 |
+
from a network server at no charge, through some standard or customary
|
548 |
+
means of facilitating copying of software. This Corresponding Source
|
549 |
+
shall include the Corresponding Source for any work covered by version 3
|
550 |
+
of the GNU General Public License that is incorporated pursuant to the
|
551 |
+
following paragraph.
|
552 |
+
|
553 |
+
Notwithstanding any other provision of this License, you have
|
554 |
+
permission to link or combine any covered work with a work licensed
|
555 |
+
under version 3 of the GNU General Public License into a single
|
556 |
+
combined work, and to convey the resulting work. The terms of this
|
557 |
+
License will continue to apply to the part which is the covered work,
|
558 |
+
but the work with which it is combined will remain governed by version
|
559 |
+
3 of the GNU General Public License.
|
560 |
+
|
561 |
+
14. Revised Versions of this License.
|
562 |
+
|
563 |
+
The Free Software Foundation may publish revised and/or new versions of
|
564 |
+
the GNU Affero General Public License from time to time. Such new versions
|
565 |
+
will be similar in spirit to the present version, but may differ in detail to
|
566 |
+
address new problems or concerns.
|
567 |
+
|
568 |
+
Each version is given a distinguishing version number. If the
|
569 |
+
Program specifies that a certain numbered version of the GNU Affero General
|
570 |
+
Public License "or any later version" applies to it, you have the
|
571 |
+
option of following the terms and conditions either of that numbered
|
572 |
+
version or of any later version published by the Free Software
|
573 |
+
Foundation. If the Program does not specify a version number of the
|
574 |
+
GNU Affero General Public License, you may choose any version ever published
|
575 |
+
by the Free Software Foundation.
|
576 |
+
|
577 |
+
If the Program specifies that a proxy can decide which future
|
578 |
+
versions of the GNU Affero General Public License can be used, that proxy's
|
579 |
+
public statement of acceptance of a version permanently authorizes you
|
580 |
+
to choose that version for the Program.
|
581 |
+
|
582 |
+
Later license versions may give you additional or different
|
583 |
+
permissions. However, no additional obligations are imposed on any
|
584 |
+
author or copyright holder as a result of your choosing to follow a
|
585 |
+
later version.
|
586 |
+
|
587 |
+
15. Disclaimer of Warranty.
|
588 |
+
|
589 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
590 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
591 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
592 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
593 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
594 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
595 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
596 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
597 |
+
|
598 |
+
16. Limitation of Liability.
|
599 |
+
|
600 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
601 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
602 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
603 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
604 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
605 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
606 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
607 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
608 |
+
SUCH DAMAGES.
|
609 |
+
|
610 |
+
17. Interpretation of Sections 15 and 16.
|
611 |
+
|
612 |
+
If the disclaimer of warranty and limitation of liability provided
|
613 |
+
above cannot be given local legal effect according to their terms,
|
614 |
+
reviewing courts shall apply local law that most closely approximates
|
615 |
+
an absolute waiver of all civil liability in connection with the
|
616 |
+
Program, unless a warranty or assumption of liability accompanies a
|
617 |
+
copy of the Program in return for a fee.
|
618 |
+
|
619 |
+
END OF TERMS AND CONDITIONS
|
620 |
+
|
621 |
+
How to Apply These Terms to Your New Programs
|
622 |
+
|
623 |
+
If you develop a new program, and you want it to be of the greatest
|
624 |
+
possible use to the public, the best way to achieve this is to make it
|
625 |
+
free software which everyone can redistribute and change under these terms.
|
626 |
+
|
627 |
+
To do so, attach the following notices to the program. It is safest
|
628 |
+
to attach them to the start of each source file to most effectively
|
629 |
+
state the exclusion of warranty; and each file should have at least
|
630 |
+
the "copyright" line and a pointer to where the full notice is found.
|
631 |
+
|
632 |
+
<one line to give the program's name and a brief idea of what it does.>
|
633 |
+
Copyright (C) <year> <name of author>
|
634 |
+
|
635 |
+
This program is free software: you can redistribute it and/or modify
|
636 |
+
it under the terms of the GNU Affero General Public License as published by
|
637 |
+
the Free Software Foundation, either version 3 of the License, or
|
638 |
+
(at your option) any later version.
|
639 |
+
|
640 |
+
This program is distributed in the hope that it will be useful,
|
641 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
642 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
643 |
+
GNU Affero General Public License for more details.
|
644 |
+
|
645 |
+
You should have received a copy of the GNU Affero General Public License
|
646 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
647 |
+
|
648 |
+
Also add information on how to contact you by electronic and paper mail.
|
649 |
+
|
650 |
+
If your software can interact with users remotely through a computer
|
651 |
+
network, you should also make sure that it provides a way for users to
|
652 |
+
get its source. For example, if your program is a web application, its
|
653 |
+
interface could display a "Source" link that leads users to an archive
|
654 |
+
of the code. There are many ways you could offer source, and different
|
655 |
+
solutions will be better for different programs; see section 13 for the
|
656 |
+
specific requirements.
|
657 |
+
|
658 |
+
You should also get your employer (if you work as a programmer) or school,
|
659 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
660 |
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
661 |
+
<https://www.gnu.org/licenses/>.
|
Makefile
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
SHELL=/bin/bash -eo pipefail
|
2 |
+
|
3 |
+
.PHONY: list fix check
|
4 |
+
|
5 |
+
list:
|
6 |
+
@LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | \
|
7 |
+
awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | \
|
8 |
+
sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
|
9 |
+
|
10 |
+
setup: setup_frontend setup_backend
|
11 |
+
|
12 |
+
setup_frontend:
|
13 |
+
npm ci
|
14 |
+
|
15 |
+
setup_backend:
|
16 |
+
rye sync
|
17 |
+
|
18 |
+
build: build_frontend build_backend
|
19 |
+
|
20 |
+
build_frontend:
|
21 |
+
npx remix vite:build
|
22 |
+
|
23 |
+
build_backend: build_frontend
|
24 |
+
docker compose build
|
25 |
+
|
26 |
+
serve_frontend:
|
27 |
+
npx remix vite:dev --host 0.0.0.0 --port 7861
|
28 |
+
|
29 |
+
serve_backend:
|
30 |
+
rye run uvicorn backend:app \
|
31 |
+
--host 0.0.0.0 --port 7860 --log-level debug --reload
|
32 |
+
|
33 |
+
fix: fix_frontend fix_backend
|
34 |
+
|
35 |
+
fix_frontend:
|
36 |
+
npx biome check --apply .
|
37 |
+
|
38 |
+
fix_backend:
|
39 |
+
rye lint
|
40 |
+
rye fmt
|
41 |
+
|
42 |
+
check: check_frontend check_backend
|
43 |
+
|
44 |
+
check_frontend:
|
45 |
+
npx tsc
|
46 |
+
|
47 |
+
check_backend:
|
48 |
+
rye run pyright
|
49 |
+
|
50 |
+
codegen_gitignore:
|
51 |
+
for i in .gitignore.d/*.gitignore; do \
|
52 |
+
{ echo "## $$i START"; cat $$i; echo "## $$i END"; }; \
|
53 |
+
done > .gitignore;
|
54 |
+
|
55 |
+
codegen_config:
|
56 |
+
jsonnet -m . config.jsonnet
|
57 |
+
yq -i e -P '.' docker-compose.yml && yq -i e -P '.' docker-compose.yml
|
58 |
+
yq -i e -P '.' docker-compose.vespa.yml && yq -i e -P '.' docker-compose.vespa.yml
|
59 |
+
|
60 |
+
codegen_graphql_backend:
|
61 |
+
python -m gql_schema_codegen \
|
62 |
+
-p ./schema/graphql_* \
|
63 |
+
-t ./backend/generated/schema_types.py
|
64 |
+
$$(command -v gsed &>/dev/null && echo "gsed" || echo "sed") \
|
65 |
+
-i '1,10 s/^from typing import/from typing_extensions import/' \
|
66 |
+
backend/generated/schema_types.py
|
67 |
+
|
68 |
+
codegen_graphql_frontend:
|
69 |
+
npx graphql-codegen --config codegen.ts
|
README.md
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Govsearch
|
3 |
+
emoji: 🏆
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: pink
|
6 |
+
sdk: docker
|
7 |
+
pinned: true
|
8 |
+
license: agpl-3.0
|
9 |
+
app_port: 7860
|
10 |
+
---
|
11 |
+
|
12 |
+
# Govsearch
|
13 |
+
|
14 |
+
Govsearch is an unofficial search application for Japanese government
|
15 |
+
documents. Similar to Govbot(https://www.govbot.go.jp/), its aim is to
|
16 |
+
improve accessibility to government documents, but it adopts a search
|
17 |
+
approach instead of a chatbot. Internally, it utilizes Vespa as the
|
18 |
+
search engine, Starlette for the backend, Remix for the frontend, and
|
19 |
+
relies on documents provided by Govbot.
|
20 |
+
|
21 |
+
## Usage
|
22 |
+
|
23 |
+
To run the application, you need to have Docker installed. Then, you
|
24 |
+
can run the following command:
|
25 |
+
|
26 |
+
```sh
|
27 |
+
echo "OPENAI_API_KEY=sk-xxx" > .env
|
28 |
+
docker build -t govsearch . && docker run -it -p 7860:7860 govsearch
|
29 |
+
open http://localhost:7860
|
30 |
+
```
|
31 |
+
|
32 |
+
To develop the application, you can run the following command:
|
33 |
+
|
34 |
+
```sh
|
35 |
+
echo "OPENAI_API_KEY=sk-xxx" > .env
|
36 |
+
docker compose up -d
|
37 |
+
(cd backend_vespa && make deploy && make feed)
|
38 |
+
open http://localhost:7861
|
39 |
+
```
|
40 |
+
|
41 |
+
## References
|
42 |
+
|
43 |
+
- Govbot
|
44 |
+
- https://govbot.go.jp/
|
45 |
+
- https://www.soumu.go.jp/main_sosiki/hyouka/soudan_n/kyotsucb_top.html#faq
|
46 |
+
- Backend
|
47 |
+
- https://www.starlette.io/
|
48 |
+
- https://ariadnegraphql.org/docs/intro
|
49 |
+
- https://docs.pydantic.dev/latest/why/
|
50 |
+
- https://github.com/openai/openai-python
|
51 |
+
- https://rye-up.com/
|
52 |
+
- Search
|
53 |
+
- https://docs.vespa.ai/en/text-matching.html
|
54 |
+
- Graphql
|
55 |
+
- https://graphql.org/learn/
|
56 |
+
- https://the-guild.dev/graphql/codegen/docs/guides/react-vue
|
57 |
+
- https://the-guild.dev/graphql/ws/get-started
|
58 |
+
- https://github.com/enisdenjo/graphql-ws
|
59 |
+
- https://github.com/sauldom102/gql_schema_codegen
|
60 |
+
- Frontend
|
61 |
+
- https://remix.run/docs/en/main/file-conventions/vite-config
|
62 |
+
- https://biomejs.dev/linter/rules/
|
63 |
+
- UI Libraries
|
64 |
+
- https://tailwindcss.com/docs/utility-first
|
65 |
+
- https://ui.shadcn.com/docs
|
66 |
+
- UI Issues
|
67 |
+
- https://github.com/radix-ui/primitives/issues/2783
|
68 |
+
- https://github.com/shadcn-ui/ui/issues/3256
|
69 |
+
- https://github.com/pacocoursey/cmdk/issues/206
|
70 |
+
- https://dninomiya.github.io/form-guide/stop-enter-submit
|
71 |
+
- Typescript
|
72 |
+
- https://www.typescriptlang.org/cheatsheets
|
73 |
+
- https://www.typescriptlang.org/docs/handbook/modules/introduction.html
|
74 |
+
- https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
75 |
+
- https://www.typescriptlang.org/docs/handbook/utility-types.html
|
76 |
+
- https://www.typescriptlang.org/docs/handbook/2/types-from-types.html
|
77 |
+
- https://www.typescriptlang.org/docs/handbook/2/narrowing.html
|
78 |
+
- Python
|
79 |
+
- https://docs.python.org/3/glossary.html
|
80 |
+
- https://docs.python.org/3/tutorial/index.html
|
81 |
+
- https://docs.python.org/3/library/ast.html
|
82 |
+
- https://docs.python.org/3/library/typing.html
|
83 |
+
- https://docs.python.org/3/library/asyncio.html
|
84 |
+
- Docker
|
85 |
+
- https://github.com/vespa-engine/docker-image/tree/master
|
86 |
+
- https://docs.docker.com/build/building/multi-stage/
|
87 |
+
- Git
|
88 |
+
- https://github.com/git-lfs/git-lfs/wiki/Tutorial
|
backend/__init__.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from starlette.applications import Starlette
|
2 |
+
from starlette.middleware import Middleware
|
3 |
+
from starlette.responses import FileResponse
|
4 |
+
from starlette.routing import Mount, Route, WebSocketRoute
|
5 |
+
from starlette.staticfiles import StaticFiles
|
6 |
+
from content_size_limit_asgi import ContentSizeLimitMiddleware
|
7 |
+
|
8 |
+
from .graphql import graphql_app
|
9 |
+
from .logger import init_logger
|
10 |
+
from .cache import cache_questions, cache_generate_summary
|
11 |
+
|
12 |
+
init_logger()
|
13 |
+
|
14 |
+
app = Starlette(
|
15 |
+
debug=True,
|
16 |
+
on_startup=[cache_questions.connect, cache_generate_summary.connect],
|
17 |
+
on_shutdown=[cache_questions.disconnect, cache_generate_summary.disconnect],
|
18 |
+
middleware=[
|
19 |
+
Middleware(
|
20 |
+
ContentSizeLimitMiddleware,
|
21 |
+
max_content_size=1024 * 32,
|
22 |
+
),
|
23 |
+
],
|
24 |
+
routes=[
|
25 |
+
Route(
|
26 |
+
"/graphql", graphql_app.handle_request, methods=["GET", "POST", "OPTIONS"]
|
27 |
+
),
|
28 |
+
WebSocketRoute("/ws/graphql", graphql_app.handle_websocket),
|
29 |
+
Mount("/assets", StaticFiles(directory="build/client/assets"), name="assets"),
|
30 |
+
Mount("/favicon.ico", FileResponse("build/client/favicon.ico")),
|
31 |
+
Route("/{path:path}", FileResponse("build/client/index.html")),
|
32 |
+
],
|
33 |
+
)
|
backend/cache.py
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from caches import Cache
|
2 |
+
|
3 |
+
cache_questions = Cache("locmem://questions")
|
4 |
+
cache_generate_summary = Cache("locmem://generate_summary")
|
backend/data.py
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from backend.generated.schema_types import Question
|
2 |
+
|
3 |
+
|
4 |
+
questions: list[Question] = [
|
5 |
+
{
|
6 |
+
"id": "M-A-b-10",
|
7 |
+
"docId": "M-A-b-10",
|
8 |
+
"categoryMajor": "子育て",
|
9 |
+
"categoryMedium": "児童手当",
|
10 |
+
"categoryMinor": None,
|
11 |
+
"question": "児童手当の申請期限を教えてください。",
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"id": "M-A-b-67",
|
15 |
+
"docId": "M-A-b-67",
|
16 |
+
"categoryMajor": "子育て",
|
17 |
+
"categoryMedium": "ひとり親家庭への支援",
|
18 |
+
"categoryMinor": None,
|
19 |
+
"question": "児童扶養手当について教えてください。",
|
20 |
+
},
|
21 |
+
{
|
22 |
+
"id": "M-B-b-39",
|
23 |
+
"docId": "M-B-b-39",
|
24 |
+
"categoryMajor": "マイナンバー",
|
25 |
+
"categoryMedium": "マイナンバーカード",
|
26 |
+
"categoryMinor": None,
|
27 |
+
"question": "マイナンバーカードに記録されている電子証明書とは何ですか。",
|
28 |
+
},
|
29 |
+
{
|
30 |
+
"id": "M-B-e-1",
|
31 |
+
"docId": "M-B-e-1",
|
32 |
+
"categoryMajor": "マイナンバー",
|
33 |
+
"categoryMedium": "マイナ保険証",
|
34 |
+
"categoryMinor": None,
|
35 |
+
"question": "マイナンバーカードを健康保険証として利用するメリットは何ですか。",
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"id": "M-C-g-1",
|
39 |
+
"docId": "M-C-g-1",
|
40 |
+
"categoryMajor": "医療保険",
|
41 |
+
"categoryMedium": "出産育児一時金",
|
42 |
+
"categoryMinor": None,
|
43 |
+
"question": "出産育児一時金について教えてください。",
|
44 |
+
},
|
45 |
+
{
|
46 |
+
"id": "M-D-d-01",
|
47 |
+
"docId": "M-D-d-01",
|
48 |
+
"categoryMajor": "年金",
|
49 |
+
"categoryMedium": "公的年金を受け取る",
|
50 |
+
"categoryMinor": None,
|
51 |
+
"question": "年金は「いつから」「いくら」受け取れますか。",
|
52 |
+
},
|
53 |
+
]
|
54 |
+
|
55 |
+
shot_user = """
|
56 |
+
## 質問
|
57 |
+
不妊治療について教えて下さい
|
58 |
+
|
59 |
+
## 参考資料
|
60 |
+
[
|
61 |
+
{
|
62 |
+
"categoryMajor": "子育て",
|
63 |
+
"categoryMedium": "不妊症・不育症に関する支援、相談",
|
64 |
+
"categoryMinor": null,
|
65 |
+
"question": "不妊治療を行っている医療機関を教えてください。",
|
66 |
+
"answer": "不妊治療を行っている医療機関は、<こちら,https://funin-fuiku.cfa.go.jp/clinic/>から検索することができます。\n(都道府県名、治療内容、その他の条件から検索できます。)"
|
67 |
+
},
|
68 |
+
{
|
69 |
+
"categoryMajor": "子育て",
|
70 |
+
"categoryMedium": "不妊症・不育症に関する支援、相談",
|
71 |
+
"categoryMinor": null,
|
72 |
+
"question": "働きながら不妊治療を続けることができるか不安です。不妊治療の内容や支援情報について教えてください。",
|
73 |
+
"answer": "働きながら不妊治療を受ける方、それを支える上司や同僚の皆さん向けに、「不妊治療と仕事との両立サポートハンドブック」を作成しています。不妊治療の内容や職場での配慮のポイント、不妊治療の方にとって役立つ情報などをまとめてありますので、詳しくは、<こちら,https://www.mhlw.go.jp/stf/newpage_14408.html>からご覧ください。\n"
|
74 |
+
},
|
75 |
+
{
|
76 |
+
"categoryMajor": "子育て",
|
77 |
+
"categoryMedium": "不妊症・不育症に関する支援、相談",
|
78 |
+
"categoryMinor": null,
|
79 |
+
"question": "不妊症・不育症について相談できる相談窓口を教えてください。",
|
80 |
+
"answer": "不妊症や不育症に悩む夫婦に対し、医学的・専門的な相談や情報提供は、都道府県、指定都市、中核市が設置している性と健康の相談センターで行っております。\n一覧は、<こちら,https://www.cfa.go.jp/policies/boshihoken/seitokenkogaiyo/>からご覧いただけます。"
|
81 |
+
},
|
82 |
+
{
|
83 |
+
"categoryMajor": "子育て",
|
84 |
+
"categoryMedium": "不妊症・不育症に関する支援、相談",
|
85 |
+
"categoryMinor": null,
|
86 |
+
"question": "不妊治療連絡カードとは何ですか。",
|
87 |
+
"answer": "不妊治療連絡カードは、不妊治療を受ける労働者の方が主治医等から診療に基づき治療や検査に必要な配慮事項について、企業の人事労務担当者に的確に伝達するためのカードで、厚生労働省において作成し、活用をお勧めしているものです。\n仕事と不妊治療との両立を行う従業員と企業の方をつなぐツールとしてお役立てください。\n\n不妊治療連絡カードの内容や様式、記載例については、<こちら,https://www.mhlw.go.jp/bunya/koyoukintou/pamphlet/dl/30b.pdf>をご覧ください。"
|
88 |
+
},
|
89 |
+
{
|
90 |
+
"categoryMajor": "子育て",
|
91 |
+
"categoryMedium": "不妊症・不育症に関する支援、相談",
|
92 |
+
"categoryMinor": null,
|
93 |
+
"question": "不妊治療にかかる費用が不安です。治療費の助成はありますか。",
|
94 |
+
"answer": "保険適用となっている不妊治療については、具体的には、タイミング法などの「一般不妊治療」や、採卵・採精か���胚移植に至るまでの基本的な「生殖補助医療」が含まれています。令和4年4月から有効性・安全性が示された不妊治療が保険適用となっています。\nまた、これに加えてそれぞれ自治体による助成を受けられる場合があります。申請手続等に関してはお住まいの都道府県又は市区町村にご確認ください。"
|
95 |
+
}
|
96 |
+
]
|
97 |
+
"""
|
98 |
+
|
99 |
+
shot_assistant = """
|
100 |
+
不妊治療に関しては、医療機関での治療、助成金の申請、両立支援など多岐にわたる情報が提供されています。これらを通じて、患者の治療と日常生活のサポートが図られています。
|
101 |
+
|
102 |
+
- 不妊治療を行っている医療機関は、[こちら](https://funin-fuiku.cfa.go.jp/clinic/)から検索できます。
|
103 |
+
- 働きながらの不妊治療支援については、「不妊治療と仕事との両立サポートハンドブック」が[こちら](https://www.mhlw.go.jp/stf/newpage_14408.html)で提供されています。
|
104 |
+
- 不妊症や不育症に関する相談は、都道府県や指定都市が設置する性と健康の相談センターで行われており、一覧は[こちら](https://www.cfa.go.jp/policies/boshihoken/seitokenkogaiyo/)から参照できます。
|
105 |
+
- 不妊治療連絡カードは、働きながら治療を受ける人が企業の人事労務担当者に必要な配慮事項を伝えるためのツールです。詳細は[こちら](https://www.mhlw.go.jp/bunya/koyoukintou/pamphlet/dl/30b.pdf)。
|
106 |
+
- 不妊治療にかかる費用の助成については、保険適用となる治療もあり、自治体による助成も受けられます。詳しくはお住まいの自治体に確認してください。
|
107 |
+
- 不妊治療と仕事の両立支援に関する情報は、[厚生労働省のページ](https://www.mhlw.go.jp/stf/newpage_14408.html)で提供されています。
|
108 |
+
- 無職で不妊治療中の方には、雇用保険の基本手当の受給が可能です。詳細は[こちら](https://www.mhlw.go.jp/stf/seisakunitsuite/bunya/0000139508.html)。
|
109 |
+
|
110 |
+
## 参考資料
|
111 |
+
|
112 |
+
- [不妊治療を行っている医療機関の検索ページ](https://funin-fuiku.cfa.go.jp/clinic/)
|
113 |
+
- [不妊治療と仕事との両立サポートハンドブック](https://www.mhlw.go.jp/stf/newpage_14408.html)
|
114 |
+
- [性と健康の相談センター一覧](https://www.cfa.go.jp/policies/boshihoken/seitokenkogaiyo/)
|
115 |
+
- [不妊治療連絡カードについて](https://www.mhlw.go.jp/bunya/koyoukintou/pamphlet/dl/30b.pdf)
|
116 |
+
- [雇用保険の基本手当について](https://www.mhlw.go.jp/stf/seisakunitsuite/bunya/0000139508.html)
|
117 |
+
"""
|
backend/generated/schema_types.py
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing_extensions import ClassVar, List, Optional, TypedDict
|
2 |
+
|
3 |
+
|
4 |
+
Query = TypedDict(
|
5 |
+
"Query",
|
6 |
+
{
|
7 |
+
"questions": "QuestionsQueryResult",
|
8 |
+
"answers": "AnswersQueryResult",
|
9 |
+
},
|
10 |
+
)
|
11 |
+
|
12 |
+
|
13 |
+
QuestionsParams = TypedDict(
|
14 |
+
"QuestionsParams",
|
15 |
+
{
|
16 |
+
"query": Optional[str],
|
17 |
+
},
|
18 |
+
)
|
19 |
+
|
20 |
+
|
21 |
+
QuestionsQueryResult = ClassVar[Optional["QuestionsPayload"]]
|
22 |
+
|
23 |
+
|
24 |
+
AnswersParams = TypedDict(
|
25 |
+
"AnswersParams",
|
26 |
+
{
|
27 |
+
"query": Optional[str],
|
28 |
+
},
|
29 |
+
)
|
30 |
+
|
31 |
+
|
32 |
+
AnswersQueryResult = ClassVar[Optional["AnswersPayload"]]
|
33 |
+
|
34 |
+
|
35 |
+
Subscription = TypedDict(
|
36 |
+
"Subscription",
|
37 |
+
{
|
38 |
+
"generateSummary": "GenerateSummarySubscriptionResult",
|
39 |
+
},
|
40 |
+
)
|
41 |
+
|
42 |
+
|
43 |
+
GenerateSummaryParams = TypedDict(
|
44 |
+
"GenerateSummaryParams",
|
45 |
+
{
|
46 |
+
"query": str,
|
47 |
+
"docIds": List[str],
|
48 |
+
},
|
49 |
+
)
|
50 |
+
|
51 |
+
|
52 |
+
GenerateSummarySubscriptionResult = ClassVar[Optional["GenerateSummaryPayload"]]
|
53 |
+
|
54 |
+
|
55 |
+
AnswersPayload = TypedDict(
|
56 |
+
"AnswersPayload",
|
57 |
+
{
|
58 |
+
"answers": Optional[List["Answer"]],
|
59 |
+
},
|
60 |
+
)
|
61 |
+
|
62 |
+
|
63 |
+
QuestionsPayload = TypedDict(
|
64 |
+
"QuestionsPayload",
|
65 |
+
{
|
66 |
+
"questions": Optional[List["Question"]],
|
67 |
+
},
|
68 |
+
)
|
69 |
+
|
70 |
+
|
71 |
+
GenerateSummaryPayload = TypedDict(
|
72 |
+
"GenerateSummaryPayload",
|
73 |
+
{
|
74 |
+
"summary": str,
|
75 |
+
},
|
76 |
+
)
|
77 |
+
|
78 |
+
|
79 |
+
Answer = TypedDict(
|
80 |
+
"Answer",
|
81 |
+
{
|
82 |
+
"id": str,
|
83 |
+
"docId": str,
|
84 |
+
"categoryMajor": Optional[str],
|
85 |
+
"categoryMedium": Optional[str],
|
86 |
+
"categoryMinor": Optional[str],
|
87 |
+
"question": str,
|
88 |
+
"answer": str,
|
89 |
+
"score": Optional[float],
|
90 |
+
},
|
91 |
+
)
|
92 |
+
|
93 |
+
|
94 |
+
Question = TypedDict(
|
95 |
+
"Question",
|
96 |
+
{
|
97 |
+
"id": str,
|
98 |
+
"docId": str,
|
99 |
+
"categoryMajor": Optional[str],
|
100 |
+
"categoryMedium": Optional[str],
|
101 |
+
"categoryMinor": Optional[str],
|
102 |
+
"question": str,
|
103 |
+
},
|
104 |
+
)
|
backend/graphql.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
from ariadne import load_schema_from_path, make_executable_schema
|
3 |
+
from ariadne.asgi import GraphQL
|
4 |
+
from ariadne.asgi.handlers import GraphQLTransportWSHandler
|
5 |
+
from .resolver import query, subscription
|
6 |
+
|
7 |
+
|
8 |
+
type_defs = load_schema_from_path("schema/graphql_qa.graphql")
|
9 |
+
schema = make_executable_schema(type_defs, query, subscription)
|
10 |
+
graphql_app = GraphQL(
|
11 |
+
schema,
|
12 |
+
debug=True,
|
13 |
+
logger=logging.getLogger("graphql"),
|
14 |
+
websocket_handler=GraphQLTransportWSHandler(),
|
15 |
+
)
|
backend/logger.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
import structlog
|
3 |
+
import sys
|
4 |
+
from pythonjsonlogger import jsonlogger
|
5 |
+
|
6 |
+
|
7 |
+
def init_logger():
|
8 |
+
structlog.configure(
|
9 |
+
processors=[
|
10 |
+
structlog.stdlib.filter_by_level,
|
11 |
+
structlog.stdlib.add_logger_name,
|
12 |
+
structlog.stdlib.add_log_level,
|
13 |
+
structlog.stdlib.PositionalArgumentsFormatter(),
|
14 |
+
structlog.processors.StackInfoRenderer(),
|
15 |
+
structlog.processors.format_exc_info,
|
16 |
+
structlog.processors.UnicodeDecoder(),
|
17 |
+
structlog.stdlib.render_to_log_kwargs,
|
18 |
+
],
|
19 |
+
logger_factory=structlog.stdlib.LoggerFactory(),
|
20 |
+
wrapper_class=structlog.stdlib.BoundLogger,
|
21 |
+
cache_logger_on_first_use=True,
|
22 |
+
)
|
23 |
+
handler = logging.StreamHandler(sys.stdout)
|
24 |
+
handler.setFormatter(jsonlogger.JsonFormatter())
|
25 |
+
root_logger = logging.getLogger()
|
26 |
+
root_logger.addHandler(handler)
|
backend/resolver.py
ADDED
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import json
|
3 |
+
from annotated_types import Len
|
4 |
+
import structlog
|
5 |
+
from typing import Optional
|
6 |
+
from openai.types.chat import ChatCompletionMessageParam
|
7 |
+
from pydantic import BaseModel, Field, validator
|
8 |
+
from typing_extensions import Annotated, AsyncGenerator, Iterable, Unpack
|
9 |
+
from ariadne import ObjectType, SubscriptionType
|
10 |
+
from graphql import GraphQLResolveInfo
|
11 |
+
from vespa.application import Vespa
|
12 |
+
from vespa.io import VespaQueryResponse
|
13 |
+
from openai import AsyncOpenAI
|
14 |
+
|
15 |
+
from .data import questions as data_questions, shot_user, shot_assistant
|
16 |
+
from .cache import cache_questions, cache_generate_summary
|
17 |
+
from .settings import VESPA_APP_URL, OPENAI_API_KEY
|
18 |
+
from .generated.schema_types import (
|
19 |
+
Answer,
|
20 |
+
AnswersParams,
|
21 |
+
AnswersQueryResult,
|
22 |
+
GenerateSummaryParams,
|
23 |
+
GenerateSummarySubscriptionResult,
|
24 |
+
Question,
|
25 |
+
QuestionsParams,
|
26 |
+
QuestionsQueryResult,
|
27 |
+
)
|
28 |
+
|
29 |
+
|
30 |
+
clientVespa = Vespa(url=VESPA_APP_URL)
|
31 |
+
clientOpenAI = AsyncOpenAI(
|
32 |
+
api_key=str(OPENAI_API_KEY),
|
33 |
+
)
|
34 |
+
logger = structlog.get_logger("qa")
|
35 |
+
query = ObjectType("Query")
|
36 |
+
|
37 |
+
|
38 |
+
class QaFieldModel(BaseModel):
|
39 |
+
sddocname: str
|
40 |
+
documentid: str
|
41 |
+
doc_id: str
|
42 |
+
category_major: Optional[str] = None
|
43 |
+
category_medium: Optional[str] = None
|
44 |
+
category_minor: Optional[str] = None
|
45 |
+
question: str
|
46 |
+
answer: str
|
47 |
+
|
48 |
+
|
49 |
+
class QaModel(BaseModel):
|
50 |
+
id: str
|
51 |
+
relevance: float
|
52 |
+
source: str
|
53 |
+
fields: QaFieldModel
|
54 |
+
|
55 |
+
|
56 |
+
class AnswersParamsModel(BaseModel):
|
57 |
+
query: Optional[str] = Field(strict=True, max_length=1024)
|
58 |
+
|
59 |
+
|
60 |
+
@query.field("answers")
|
61 |
+
async def resolve_answer(
|
62 |
+
_, info: GraphQLResolveInfo, **params: Unpack[AnswersParams]
|
63 |
+
) -> AnswersQueryResult:
|
64 |
+
assert info is not None, "Prevent type check error"
|
65 |
+
|
66 |
+
params_parsed = AnswersParamsModel.model_validate(params, strict=True)
|
67 |
+
answers: list[Answer] = []
|
68 |
+
|
69 |
+
query = params_parsed.query
|
70 |
+
if not query:
|
71 |
+
logger.warning("Query is empty", params=params_parsed)
|
72 |
+
return {"answers": answers}
|
73 |
+
query_parsed = (
|
74 |
+
query.replace("\\", "\\\\")
|
75 |
+
.replace('"', '\\"')
|
76 |
+
.replace(":", "\\:")
|
77 |
+
.replace(")", "\\)")
|
78 |
+
)
|
79 |
+
|
80 |
+
base = "select * from qa where"
|
81 |
+
anno = "{targetHits:100,approximate:false}"
|
82 |
+
cond01 = f"({anno}nearestNeighbor(answer_embedding_me5s, q))"
|
83 |
+
cond02 = f"({anno}nearestNeighbor(question_embedding_me5s, q))"
|
84 |
+
|
85 |
+
async with clientVespa.asyncio() as sess:
|
86 |
+
res: VespaQueryResponse = await sess.query(
|
87 |
+
yql=f"{base} {cond01} or {cond02}",
|
88 |
+
lang="ja",
|
89 |
+
hits=20,
|
90 |
+
ranking="semantic",
|
91 |
+
body={
|
92 |
+
"input.query(q)": f'embed(multilingual-e5-small, "query: {query_parsed}")',
|
93 |
+
},
|
94 |
+
)
|
95 |
+
if not res.is_successful():
|
96 |
+
logger.warning("Vespa query failed", json=res.json, status=res.status_code)
|
97 |
+
return {"answers": answers}
|
98 |
+
|
99 |
+
hits = [QaModel.model_validate(hit, strict=True) for hit in res.hits]
|
100 |
+
answers = [
|
101 |
+
Answer(
|
102 |
+
id=hit.fields.doc_id,
|
103 |
+
docId=hit.fields.doc_id,
|
104 |
+
categoryMajor=hit.fields.category_major,
|
105 |
+
categoryMedium=hit.fields.category_medium,
|
106 |
+
categoryMinor=hit.fields.category_minor,
|
107 |
+
question=hit.fields.question,
|
108 |
+
answer=hit.fields.answer,
|
109 |
+
score=hit.relevance,
|
110 |
+
)
|
111 |
+
for hit in hits
|
112 |
+
]
|
113 |
+
|
114 |
+
return {"answers": answers}
|
115 |
+
|
116 |
+
|
117 |
+
class QuestionsParamsModel(BaseModel):
|
118 |
+
query: Optional[str] = Field(strict=True, max_length=1024)
|
119 |
+
|
120 |
+
|
121 |
+
@query.field("questions")
|
122 |
+
async def resolve_question(
|
123 |
+
_, info: GraphQLResolveInfo, **params: Unpack[QuestionsParams]
|
124 |
+
) -> QuestionsQueryResult:
|
125 |
+
assert info is not None, "Prevent type check error"
|
126 |
+
|
127 |
+
params_parsed = QuestionsParamsModel.model_validate(params, strict=True)
|
128 |
+
questions: list[Question] = data_questions
|
129 |
+
|
130 |
+
query = params_parsed.query
|
131 |
+
if query is None:
|
132 |
+
logger.warning("Query is empty", params=params_parsed)
|
133 |
+
return {"questions": questions}
|
134 |
+
query_parsed = (
|
135 |
+
query.replace("\\", "\\\\")
|
136 |
+
.replace('"', '\\"')
|
137 |
+
.replace(":", "\\:")
|
138 |
+
.replace(")", "\\)")
|
139 |
+
)
|
140 |
+
|
141 |
+
cached_questions = await cache_questions.get(query)
|
142 |
+
if isinstance(cached_questions, list):
|
143 |
+
return {"questions": cached_questions}
|
144 |
+
|
145 |
+
base = "select * from qa where"
|
146 |
+
anno = "{targetHits:100,approximate:false}"
|
147 |
+
cond01 = "({targetHits:100}userInput(@condQuery))"
|
148 |
+
cond02 = f'(question matches "{query_parsed}")'
|
149 |
+
cond03 = f"({anno}nearestNeighbor(question_embedding_me5s, q))"
|
150 |
+
|
151 |
+
async with clientVespa.asyncio() as sess:
|
152 |
+
res: VespaQueryResponse = await sess.query(
|
153 |
+
yql=f"{base} {cond01} or {cond02} or {cond03}",
|
154 |
+
lang="ja",
|
155 |
+
hits=20,
|
156 |
+
ranking="question_semantic",
|
157 |
+
body={
|
158 |
+
"condQuery": query,
|
159 |
+
"input.query(q)": f'embed(multilingual-e5-small, "query: {query_parsed}")',
|
160 |
+
},
|
161 |
+
)
|
162 |
+
if not res.is_successful():
|
163 |
+
logger.warning("Vespa query failed", json=res.json, status=res.status_code)
|
164 |
+
return {"questions": questions}
|
165 |
+
|
166 |
+
hits = [QaModel.model_validate(hit, strict=True) for hit in res.hits]
|
167 |
+
questions = [
|
168 |
+
Question(
|
169 |
+
id=hit.fields.doc_id,
|
170 |
+
docId=hit.fields.doc_id,
|
171 |
+
categoryMajor=hit.fields.category_major,
|
172 |
+
categoryMedium=hit.fields.category_medium,
|
173 |
+
categoryMinor=hit.fields.category_minor,
|
174 |
+
question=hit.fields.question,
|
175 |
+
)
|
176 |
+
for hit in hits
|
177 |
+
]
|
178 |
+
|
179 |
+
await cache_questions.set(query, questions)
|
180 |
+
return {"questions": questions}
|
181 |
+
|
182 |
+
|
183 |
+
subscription = SubscriptionType()
|
184 |
+
|
185 |
+
|
186 |
+
class GenerateSummaryParamsModel(BaseModel):
|
187 |
+
query: str = Field(strict=True, max_length=1024)
|
188 |
+
docIds: Annotated[list[str], Len(max_length=10)]
|
189 |
+
|
190 |
+
@validator("docIds", each_item=True)
|
191 |
+
def check_max_length(cls, v):
|
192 |
+
if len(v) > 1024:
|
193 |
+
raise ValueError("string length exceeds maximum of 1024")
|
194 |
+
return v
|
195 |
+
|
196 |
+
|
197 |
+
@subscription.source("generateSummary")
|
198 |
+
async def generate_generate_summary(
|
199 |
+
_, info: GraphQLResolveInfo, **params: Unpack[GenerateSummaryParams]
|
200 |
+
) -> AsyncGenerator[str, str]:
|
201 |
+
assert info is not None, "Prevent type check error"
|
202 |
+
|
203 |
+
params_parsed = GenerateSummaryParamsModel.model_validate(params, strict=True)
|
204 |
+
if not params_parsed.query:
|
205 |
+
logger.warning("No query found", params=params_parsed)
|
206 |
+
return
|
207 |
+
|
208 |
+
doc_ids = params_parsed.docIds or []
|
209 |
+
if not doc_ids:
|
210 |
+
logger.warning("No docIds found", params=params_parsed)
|
211 |
+
return
|
212 |
+
|
213 |
+
key = params_parsed.query + "|" + "|".join(sorted(doc_ids))
|
214 |
+
cached_summary = await cache_generate_summary.get(key)
|
215 |
+
if isinstance(cached_summary, str):
|
216 |
+
for char in cached_summary:
|
217 |
+
yield char
|
218 |
+
await asyncio.sleep(0.05)
|
219 |
+
return
|
220 |
+
|
221 |
+
query_in = ", ".join(
|
222 |
+
['"' + x.replace("\\", "\\\\").replace('"', '\\"') + '"' for x in doc_ids]
|
223 |
+
)
|
224 |
+
answers = []
|
225 |
+
async with clientVespa.asyncio() as sess:
|
226 |
+
res: VespaQueryResponse = await sess.query(
|
227 |
+
yql=f"select * from qa where doc_id in ({query_in})",
|
228 |
+
lang="ja",
|
229 |
+
hits=5,
|
230 |
+
)
|
231 |
+
if not res.is_successful():
|
232 |
+
logger.warning("Vespa query failed", json=res.json, status=res.status_code)
|
233 |
+
return
|
234 |
+
|
235 |
+
hits = [QaModel.model_validate(hit, strict=True) for hit in res.hits]
|
236 |
+
answers = [
|
237 |
+
{
|
238 |
+
"docId": hit.fields.doc_id,
|
239 |
+
"answer": hit.fields.answer,
|
240 |
+
"score": hit.relevance,
|
241 |
+
}
|
242 |
+
for hit in hits
|
243 |
+
]
|
244 |
+
|
245 |
+
if not answers:
|
246 |
+
logger.warning("No answers found", params=params_parsed)
|
247 |
+
return
|
248 |
+
|
249 |
+
system = """あなたには質問(question)と参考資料(references)が与えられます。
|
250 |
+
あなたの仕事は以下の2つです。
|
251 |
+
|
252 |
+
- 与えられた参考資料にかかれている情報のみを使って質問に回答する。
|
253 |
+
- 参考資料の要約をわかりやすくまとめる。
|
254 |
+
|
255 |
+
以下のルールに従ってください:
|
256 |
+
|
257 |
+
- 回答には参考資料に書かれている正確な情報のみを反映してください。
|
258 |
+
- 回答や要約には外部の情報や暗黙の知識は反映しないでください。
|
259 |
+
|
260 |
+
以下のフォーマットで出力してください:
|
261 |
+
|
262 |
+
```
|
263 |
+
### 回答
|
264 |
+
|
265 |
+
ここに回答を書いてください。
|
266 |
+
|
267 |
+
### 要約
|
268 |
+
|
269 |
+
ここに要約を書いてください。
|
270 |
+
```
|
271 |
+
"""
|
272 |
+
user = f"""
|
273 |
+
## 質問
|
274 |
+
{params_parsed.query}
|
275 |
+
|
276 |
+
## 参考資料
|
277 |
+
{json.dumps(answers, ensure_ascii=False, indent=2)}
|
278 |
+
"""
|
279 |
+
messages: Iterable[ChatCompletionMessageParam] = [
|
280 |
+
{"role": "system", "name": "instruction", "content": system},
|
281 |
+
{"role": "user", "name": "info", "content": shot_user},
|
282 |
+
{"role": "assistant", "name": "summary", "content": shot_assistant},
|
283 |
+
{"role": "user", "name": "info", "content": user},
|
284 |
+
]
|
285 |
+
print("OpenAI chat completions", f"messages={messages}")
|
286 |
+
stream = await clientOpenAI.chat.completions.create(
|
287 |
+
messages=messages,
|
288 |
+
model="gpt-4-turbo-2024-04-09",
|
289 |
+
stream=True,
|
290 |
+
)
|
291 |
+
|
292 |
+
summary = ""
|
293 |
+
async for chunk in stream:
|
294 |
+
content = chunk.choices[0].delta.content or ""
|
295 |
+
summary += content
|
296 |
+
# FIXME: sanitize to return only elements that are not dangerous as markdown
|
297 |
+
yield content
|
298 |
+
|
299 |
+
await cache_generate_summary.set(key, summary)
|
300 |
+
return
|
301 |
+
|
302 |
+
|
303 |
+
@subscription.field("generateSummary")
|
304 |
+
def resolve_generate_summary(
|
305 |
+
summary: str, info: GraphQLResolveInfo, **params: Unpack[GenerateSummaryParams]
|
306 |
+
) -> GenerateSummarySubscriptionResult:
|
307 |
+
assert info and params, "Prevent type check error"
|
308 |
+
return {"summary": summary}
|
backend/settings.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from starlette.config import Config
|
2 |
+
from starlette.datastructures import Secret
|
3 |
+
|
4 |
+
config = Config(env_file=".env")
|
5 |
+
|
6 |
+
VESPA_APP_URL = config("VESPA_APP_URL", default="http://localhost:4080")
|
7 |
+
OPENAI_API_KEY = config(
|
8 |
+
"OPENAI_API_KEY", default="__OPENAI_API_KEY_NOT_SET__", cast=Secret
|
9 |
+
)
|
backend_vespa/Makefile
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
SHELL=/bin/bash -eo pipefail
|
2 |
+
|
3 |
+
.PHONY: list clean setup convert_to_onix
|
4 |
+
|
5 |
+
list:
|
6 |
+
@LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | \
|
7 |
+
awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | \
|
8 |
+
sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
|
9 |
+
clean:
|
10 |
+
rm -rf target
|
11 |
+
|
12 |
+
package: clean
|
13 |
+
mvn package
|
14 |
+
|
15 |
+
deploy: package
|
16 |
+
vespa deploy -t local --wait 300
|
17 |
+
|
18 |
+
feed:
|
19 |
+
vespa feed - < ../data/000936301.jsonl
|
20 |
+
|
21 |
+
check_reindex:
|
22 |
+
vespa curl -s deploy \
|
23 |
+
/application/v2/tenant/default/application/default/environment/prod/region/default/instance/default/reindexing | jq .
|
24 |
+
|
25 |
+
convert_to_onix_base:
|
26 |
+
rye run python ../scripts/export_hf_model_from_hf.py \
|
27 |
+
--hf_model intfloat/multilingual-e5-base --output_dir multilingual-e5-base
|
28 |
+
rye run optimum-cli onnxruntime quantize \
|
29 |
+
--onnx_model multilingual-e5-base --avx2 -o multilingual-e5-base-quantized
|
30 |
+
|
31 |
+
copy_model_to_app_base:
|
32 |
+
cp -a multilingual-e5-base-quantized/model_quantized.onnx \
|
33 |
+
src/main/application/model/multilingual-e5-base-model_quantized.onnx
|
34 |
+
cp -a multilingual-e5-base-quantized/tokenizer.json \
|
35 |
+
src/main/application/model/multilingual-e5-base-tokenizer.json
|
36 |
+
|
37 |
+
convert_to_onix_small:
|
38 |
+
rye run python ../scripts/export_hf_model_from_hf.py \
|
39 |
+
--hf_model intfloat/multilingual-e5-small --output_dir multilingual-e5-small
|
40 |
+
rye run optimum-cli onnxruntime quantize \
|
41 |
+
--onnx_model multilingual-e5-small --avx2 -o multilingual-e5-small-quantized
|
42 |
+
|
43 |
+
copy_model_to_app_small:
|
44 |
+
cp -a multilingual-e5-small-quantized/model_quantized.onnx \
|
45 |
+
src/main/application/model/multilingual-e5-small-model_quantized.onnx
|
46 |
+
cp -a multilingual-e5-small-quantized/tokenizer.json \
|
47 |
+
src/main/application/model/multilingual-e5-small-tokenizer.json
|
48 |
+
|
49 |
+
remove_model_from_app:
|
50 |
+
rm -f src/main/application/model/*
|
backend_vespa/multilingual-e5-small-quantized/model_quantized.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:15609ad1718cd4565e6e94f02abdee21ae0840ea44fb54d31cc07a6908072f60
|
3 |
+
size 118322572
|
backend_vespa/multilingual-e5-small-quantized/ort_config.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5ca2232004d70b9312da2e771e157746e1794c5dca52d35beae0d94274d9e04c
|
3 |
+
size 831
|
backend_vespa/multilingual-e5-small-quantized/sentencepiece.bpe.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
|
3 |
+
size 5069051
|
backend_vespa/multilingual-e5-small-quantized/special_tokens_map.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8c785abebea9ae3257b61681b4e6fd8365ceafde980c21970d001e834cf10835
|
3 |
+
size 964
|
backend_vespa/multilingual-e5-small-quantized/tokenizer.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:46877b3f800bf28b4cda6ab2197210ef1fe17c878b20e3a41819ee0ea7d27b76
|
3 |
+
size 11082630
|
backend_vespa/multilingual-e5-small-quantized/tokenizer_config.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:abb78061a3b9cc3aa7623520f08cc4c2d10942ca1531bdf8f303937b2e7a3b56
|
3 |
+
size 1172
|
backend_vespa/multilingual-e5-small/model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:66775c81c6056fe3370488807401f814a30d9467b18d01b3f0b116fb5b34a0c8
|
3 |
+
size 470869701
|
backend_vespa/multilingual-e5-small/sentencepiece.bpe.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
|
3 |
+
size 5069051
|
backend_vespa/multilingual-e5-small/special_tokens_map.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:06e405a36dfe4b9604f484f6a1e619af1a7f7d09e34a8555eb0b77b66318067f
|
3 |
+
size 280
|
backend_vespa/multilingual-e5-small/tokenizer.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2b3f6fc9286922cf30646a1957c81e5655f977d2204c9631b7624f21d6c641b5
|
3 |
+
size 17082757
|
backend_vespa/multilingual-e5-small/tokenizer_config.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:abb78061a3b9cc3aa7623520f08cc4c2d10942ca1531bdf8f303937b2e7a3b56
|
3 |
+
size 1172
|
backend_vespa/pom.xml
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<project
|
3 |
+
xmlns="http://maven.apache.org/POM/4.0.0"
|
4 |
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
5 |
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
6 |
+
http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
7 |
+
>
|
8 |
+
<modelVersion>4.0.0</modelVersion>
|
9 |
+
<groupId>jp.hicustomer</groupId>
|
10 |
+
<artifactId>govsearch</artifactId>
|
11 |
+
<version>0.0.1</version>
|
12 |
+
<packaging>container-plugin</packaging>
|
13 |
+
<properties>
|
14 |
+
<bundle-plugin.failOnWarnings>false</bundle-plugin.failOnWarnings>
|
15 |
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
16 |
+
<test.hide>true</test.hide>
|
17 |
+
<vespa_version>8.324.16</vespa_version>
|
18 |
+
</properties>
|
19 |
+
|
20 |
+
<dependencies>
|
21 |
+
<dependency>
|
22 |
+
<groupId>com.yahoo.vespa</groupId>
|
23 |
+
<artifactId>lucene-linguistics</artifactId>
|
24 |
+
<version>${vespa_version}</version>
|
25 |
+
</dependency>
|
26 |
+
<dependency>
|
27 |
+
<groupId>com.yahoo.vespa</groupId>
|
28 |
+
<artifactId>linguistics</artifactId>
|
29 |
+
<version>${vespa_version}</version>
|
30 |
+
<scope>provided</scope>
|
31 |
+
</dependency>
|
32 |
+
<dependency>
|
33 |
+
<groupId>com.yahoo.vespa</groupId>
|
34 |
+
<artifactId>application</artifactId>
|
35 |
+
<version>${vespa_version}</version>
|
36 |
+
<scope>provided</scope>
|
37 |
+
</dependency>
|
38 |
+
</dependencies>
|
39 |
+
|
40 |
+
<build>
|
41 |
+
<plugins>
|
42 |
+
<plugin>
|
43 |
+
<groupId>com.yahoo.vespa</groupId>
|
44 |
+
<artifactId>bundle-plugin</artifactId>
|
45 |
+
<version>${vespa_version}</version>
|
46 |
+
<extensions>true</extensions>
|
47 |
+
<configuration>
|
48 |
+
<failOnWarnings>false</failOnWarnings>
|
49 |
+
</configuration>
|
50 |
+
</plugin>
|
51 |
+
<plugin>
|
52 |
+
<groupId>com.yahoo.vespa</groupId>
|
53 |
+
<artifactId>vespa-application-maven-plugin</artifactId>
|
54 |
+
<version>${vespa_version}</version>
|
55 |
+
<executions>
|
56 |
+
<execution>
|
57 |
+
<goals>
|
58 |
+
<goal>packageApplication</goal>
|
59 |
+
</goals>
|
60 |
+
</execution>
|
61 |
+
</executions>
|
62 |
+
</plugin>
|
63 |
+
<plugin>
|
64 |
+
<groupId>org.apache.maven.plugins</groupId>
|
65 |
+
<artifactId>maven-compiler-plugin</artifactId>
|
66 |
+
<version>3.11.0</version>
|
67 |
+
<configuration>
|
68 |
+
<source>17</source>
|
69 |
+
<target>17</target>
|
70 |
+
</configuration>
|
71 |
+
</plugin>
|
72 |
+
</plugins>
|
73 |
+
</build>
|
74 |
+
</project>
|
backend_vespa/src/main/application/components/kuromoji-linguistics-2.0.3.jar
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0eb48ee595d6df45687964229b322d670638a712cc808e1d71bdd802e31423d6
|
3 |
+
size 13179612
|
backend_vespa/src/main/application/model/.keep
ADDED
File without changes
|