.gitignore CHANGED
@@ -1 +1,2 @@
1
  .env
 
 
1
  .env
2
+ __pycache__
README.md CHANGED
@@ -10,4 +10,18 @@ pinned: true
10
  license: mit
11
  ---
12
 
13
- An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  license: mit
11
  ---
12
 
13
+ An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
14
+
15
+
16
+
17
+ ```
18
+ virtualenv .venv
19
+ .venv/bin/activate
20
+ pip install -r requirements.txt
21
+
22
+ ```
23
+
24
+ `ALLOW_RESET=TRUE ./.venv/bin/chroma run --host localhost --port 8000`
25
+
26
+ `python ./app.py`
27
+
__pycache__/globalvars.cpython-310.pyc DELETED
Binary file (5.04 kB)
 
__pycache__/utils.cpython-310.pyc DELETED
Binary file (789 Bytes)
 
app.py CHANGED
@@ -122,7 +122,7 @@ def load_documents(file_path: str, mode: str = "elements"):
122
  return [doc.page_content for doc in docs]
123
 
124
  def initialize_chroma(collection_name: str, embedding_function: MyEmbeddingFunction):
125
- client = chromadb.HttpClient(host='localhost', port=8000, settings = Settings(allow_reset=True, anonymized_telemetry=False))
126
  client.reset() # resets the database
127
  collection = client.create_collection(collection_name)
128
  return client, collection
@@ -207,4 +207,4 @@ with gr.Blocks() as demo:
207
  query_button.click(query_documents, inputs=query_input, outputs=query_output)
208
 
209
  if __name__ == "__main__":
210
- demo.launch()
 
122
  return [doc.page_content for doc in docs]
123
 
124
  def initialize_chroma(collection_name: str, embedding_function: MyEmbeddingFunction):
125
+ client = HttpClient(host='localhost', port=8000, settings = Settings(allow_reset=True, anonymized_telemetry=False))
126
  client.reset() # resets the database
127
  collection = client.create_collection(collection_name)
128
  return client, collection
 
207
  query_button.click(query_documents, inputs=query_input, outputs=query_output)
208
 
209
  if __name__ == "__main__":
210
+ demo.launch()
chroma.log DELETED
@@ -1,414 +0,0 @@
1
- WARNING: [11-07-2024 13:19:17] chroma_server_nofile is set to 65535, but this is less than current soft limit of 1048576. chroma_server_nofile will not be set.
2
- INFO: [11-07-2024 13:19:17] Anonymized telemetry enabled. See https://docs.trychroma.com/telemetry for more information.
3
- DEBUG: [11-07-2024 13:19:17] Starting component System
4
- DEBUG: [11-07-2024 13:19:17] Starting component OpenTelemetryClient
5
- DEBUG: [11-07-2024 13:19:17] Starting component SqliteDB
6
- DEBUG: [11-07-2024 13:19:17] Starting component QuotaEnforcer
7
- DEBUG: [11-07-2024 13:19:17] Starting component Posthog
8
- DEBUG: [11-07-2024 13:19:17] Starting component LocalSegmentManager
9
- DEBUG: [11-07-2024 13:19:17] Starting component SegmentAPI
10
- INFO: [11-07-2024 13:19:17] Started server process [1896]
11
- INFO: [11-07-2024 13:19:17] Waiting for application startup.
12
- INFO: [11-07-2024 13:19:17] Application startup complete.
13
- INFO: [11-07-2024 13:19:17] Uvicorn running on http://localhost:8000 (Press CTRL+C to quit)
14
- INFO: [11-07-2024 13:19:20] ::1:45976 - "GET /api/v1/tenants/default_tenant HTTP/1.1" 200
15
- INFO: [11-07-2024 13:19:20] ::1:45976 - "GET /api/v1/databases/default_database?tenant=default_tenant HTTP/1.1" 200
16
- INFO: [11-07-2024 13:19:20] ::1:45982 - "POST /api/v1/collections?tenant=default_tenant&database=default_database HTTP/1.1" 200
17
- INFO: [11-07-2024 13:25:26] ::1:51020 - "GET /api/v1/tenants/default_tenant HTTP/1.1" 200
18
- INFO: [11-07-2024 13:25:26] ::1:51020 - "GET /api/v1/databases/default_database?tenant=default_tenant HTTP/1.1" 200
19
- ERROR: [11-07-2024 13:25:26] Collection Tonic-instruct already exists
20
- Traceback (most recent call last):
21
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 105, in receive
22
- return self.receive_nowait()
23
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 100, in receive_nowait
24
- raise WouldBlock
25
- anyio.WouldBlock
26
-
27
- During handling of the above exception, another exception occurred:
28
-
29
- Traceback (most recent call last):
30
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 118, in receive
31
- return receiver.item
32
- AttributeError: 'MemoryObjectItemReceiver' object has no attribute 'item'
33
-
34
- During handling of the above exception, another exception occurred:
35
-
36
- Traceback (most recent call last):
37
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 159, in call_next
38
- message = await recv_stream.receive()
39
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 120, in receive
40
- raise EndOfStream
41
- anyio.EndOfStream
42
-
43
- During handling of the above exception, another exception occurred:
44
-
45
- Traceback (most recent call last):
46
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 76, in catch_exceptions_middleware
47
- return await call_next(request)
48
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 165, in call_next
49
- raise app_exc
50
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 151, in coro
51
- await self.app(scope, receive_or_disconnect, send_no_error)
52
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 189, in __call__
53
- with collapse_excgroups():
54
- File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
55
- self.gen.throw(typ, value, traceback)
56
- File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
57
- raise exc
58
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
59
- response = await self.dispatch_func(request, call_next)
60
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 90, in check_http_version_middleware
61
- return await call_next(request)
62
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 165, in call_next
63
- raise app_exc
64
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 151, in coro
65
- await self.app(scope, receive_or_disconnect, send_no_error)
66
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
67
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
68
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
69
- raise exc
70
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
71
- await app(scope, receive, sender)
72
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__
73
- await self.middleware_stack(scope, receive, send)
74
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 776, in app
75
- await route.handle(scope, receive, send)
76
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle
77
- await self.app(scope, receive, send)
78
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 77, in app
79
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
80
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
81
- raise exc
82
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
83
- await app(scope, receive, sender)
84
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 72, in app
85
- response = await func(request)
86
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app
87
- raw_response = await run_endpoint_function(
88
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
89
- return await dependant.call(**values)
90
- File "/usr/local/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 133, in async_wrapper
91
- return await f(*args, **kwargs)
92
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 601, in create_collection
93
- await to_thread.run_sync(
94
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
95
- return await get_async_backend().run_sync_in_worker_thread(
96
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
97
- return await future
98
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run
99
- result = context.run(func, *args)
100
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 590, in process_create_collection
101
- return self._api.create_collection(
102
- File "/usr/local/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 146, in wrapper
103
- return f(*args, **kwargs)
104
- File "/usr/local/lib/python3.10/site-packages/chromadb/api/segment.py", line 176, in create_collection
105
- coll, created = self._sysdb.create_collection(
106
- File "/usr/local/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 146, in wrapper
107
- return f(*args, **kwargs)
108
- File "/usr/local/lib/python3.10/site-packages/chromadb/db/mixins/sysdb.py", line 227, in create_collection
109
- raise UniqueConstraintError(f"Collection {name} already exists")
110
- chromadb.db.base.UniqueConstraintError: Collection Tonic-instruct already exists
111
- INFO: [11-07-2024 13:25:26] ::1:51028 - "POST /api/v1/collections?tenant=default_tenant&database=default_database HTTP/1.1" 500
112
- INFO: [11-07-2024 13:26:47] ::1:60970 - "GET /api/v1/tenants/default_tenant HTTP/1.1" 200
113
- INFO: [11-07-2024 13:26:47] ::1:60970 - "GET /api/v1/databases/default_database?tenant=default_tenant HTTP/1.1" 200
114
- ERROR: [11-07-2024 13:26:47] Collection Tonic-instruct already exists
115
- Traceback (most recent call last):
116
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 105, in receive
117
- return self.receive_nowait()
118
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 100, in receive_nowait
119
- raise WouldBlock
120
- anyio.WouldBlock
121
-
122
- During handling of the above exception, another exception occurred:
123
-
124
- Traceback (most recent call last):
125
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 118, in receive
126
- return receiver.item
127
- AttributeError: 'MemoryObjectItemReceiver' object has no attribute 'item'
128
-
129
- During handling of the above exception, another exception occurred:
130
-
131
- Traceback (most recent call last):
132
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 159, in call_next
133
- message = await recv_stream.receive()
134
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 120, in receive
135
- raise EndOfStream
136
- anyio.EndOfStream
137
-
138
- During handling of the above exception, another exception occurred:
139
-
140
- Traceback (most recent call last):
141
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 76, in catch_exceptions_middleware
142
- return await call_next(request)
143
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 165, in call_next
144
- raise app_exc
145
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 151, in coro
146
- await self.app(scope, receive_or_disconnect, send_no_error)
147
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 189, in __call__
148
- with collapse_excgroups():
149
- File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
150
- self.gen.throw(typ, value, traceback)
151
- File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
152
- raise exc
153
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
154
- response = await self.dispatch_func(request, call_next)
155
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 90, in check_http_version_middleware
156
- return await call_next(request)
157
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 165, in call_next
158
- raise app_exc
159
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 151, in coro
160
- await self.app(scope, receive_or_disconnect, send_no_error)
161
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
162
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
163
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
164
- raise exc
165
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
166
- await app(scope, receive, sender)
167
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__
168
- await self.middleware_stack(scope, receive, send)
169
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 776, in app
170
- await route.handle(scope, receive, send)
171
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle
172
- await self.app(scope, receive, send)
173
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 77, in app
174
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
175
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
176
- raise exc
177
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
178
- await app(scope, receive, sender)
179
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 72, in app
180
- response = await func(request)
181
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app
182
- raw_response = await run_endpoint_function(
183
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
184
- return await dependant.call(**values)
185
- File "/usr/local/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 133, in async_wrapper
186
- return await f(*args, **kwargs)
187
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 601, in create_collection
188
- await to_thread.run_sync(
189
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
190
- return await get_async_backend().run_sync_in_worker_thread(
191
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
192
- return await future
193
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run
194
- result = context.run(func, *args)
195
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 590, in process_create_collection
196
- return self._api.create_collection(
197
- File "/usr/local/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 146, in wrapper
198
- return f(*args, **kwargs)
199
- File "/usr/local/lib/python3.10/site-packages/chromadb/api/segment.py", line 176, in create_collection
200
- coll, created = self._sysdb.create_collection(
201
- File "/usr/local/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 146, in wrapper
202
- return f(*args, **kwargs)
203
- File "/usr/local/lib/python3.10/site-packages/chromadb/db/mixins/sysdb.py", line 227, in create_collection
204
- raise UniqueConstraintError(f"Collection {name} already exists")
205
- chromadb.db.base.UniqueConstraintError: Collection Tonic-instruct already exists
206
- INFO: [11-07-2024 13:26:47] ::1:60976 - "POST /api/v1/collections?tenant=default_tenant&database=default_database HTTP/1.1" 500
207
- INFO: [11-07-2024 13:27:20] Shutting down
208
- INFO: [11-07-2024 13:27:20] Waiting for application shutdown.
209
- DEBUG: [11-07-2024 13:27:20] Stopping component System
210
- DEBUG: [11-07-2024 13:27:20] Stopping component SegmentAPI
211
- DEBUG: [11-07-2024 13:27:20] Stopping component LocalSegmentManager
212
- DEBUG: [11-07-2024 13:27:20] Stopping component Posthog
213
- DEBUG: [11-07-2024 13:27:20] Stopping component QuotaEnforcer
214
- DEBUG: [11-07-2024 13:27:20] Stopping component SqliteDB
215
- DEBUG: [11-07-2024 13:27:20] Stopping component OpenTelemetryClient
216
- INFO: [11-07-2024 13:27:20] Application shutdown complete.
217
- INFO: [11-07-2024 13:27:20] Finished server process [1896]
218
- WARNING: [11-07-2024 13:27:24] chroma_server_nofile is set to 65535, but this is less than current soft limit of 1048576. chroma_server_nofile will not be set.
219
- INFO: [11-07-2024 13:27:24] Anonymized telemetry enabled. See https://docs.trychroma.com/telemetry for more information.
220
- DEBUG: [11-07-2024 13:27:24] Starting component System
221
- DEBUG: [11-07-2024 13:27:24] Starting component OpenTelemetryClient
222
- DEBUG: [11-07-2024 13:27:24] Starting component SqliteDB
223
- DEBUG: [11-07-2024 13:27:24] Starting component QuotaEnforcer
224
- DEBUG: [11-07-2024 13:27:24] Starting component Posthog
225
- DEBUG: [11-07-2024 13:27:24] Starting component LocalSegmentManager
226
- DEBUG: [11-07-2024 13:27:24] Starting component SegmentAPI
227
- INFO: [11-07-2024 13:27:25] Started server process [3749]
228
- INFO: [11-07-2024 13:27:25] Waiting for application startup.
229
- INFO: [11-07-2024 13:27:25] Application startup complete.
230
- INFO: [11-07-2024 13:27:25] Uvicorn running on http://localhost:8000 (Press CTRL+C to quit)
231
- INFO: [11-07-2024 13:27:37] ::1:51602 - "GET /api/v1/tenants/default_tenant HTTP/1.1" 200
232
- INFO: [11-07-2024 13:27:37] ::1:51602 - "GET /api/v1/databases/default_database?tenant=default_tenant HTTP/1.1" 200
233
- ERROR: [11-07-2024 13:27:37] Collection Tonic-instruct already exists
234
- Traceback (most recent call last):
235
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 105, in receive
236
- return self.receive_nowait()
237
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 100, in receive_nowait
238
- raise WouldBlock
239
- anyio.WouldBlock
240
-
241
- During handling of the above exception, another exception occurred:
242
-
243
- Traceback (most recent call last):
244
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 118, in receive
245
- return receiver.item
246
- AttributeError: 'MemoryObjectItemReceiver' object has no attribute 'item'
247
-
248
- During handling of the above exception, another exception occurred:
249
-
250
- Traceback (most recent call last):
251
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 159, in call_next
252
- message = await recv_stream.receive()
253
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 120, in receive
254
- raise EndOfStream
255
- anyio.EndOfStream
256
-
257
- During handling of the above exception, another exception occurred:
258
-
259
- Traceback (most recent call last):
260
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 76, in catch_exceptions_middleware
261
- return await call_next(request)
262
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 165, in call_next
263
- raise app_exc
264
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 151, in coro
265
- await self.app(scope, receive_or_disconnect, send_no_error)
266
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 189, in __call__
267
- with collapse_excgroups():
268
- File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
269
- self.gen.throw(typ, value, traceback)
270
- File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
271
- raise exc
272
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
273
- response = await self.dispatch_func(request, call_next)
274
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 90, in check_http_version_middleware
275
- return await call_next(request)
276
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 165, in call_next
277
- raise app_exc
278
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 151, in coro
279
- await self.app(scope, receive_or_disconnect, send_no_error)
280
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
281
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
282
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
283
- raise exc
284
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
285
- await app(scope, receive, sender)
286
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__
287
- await self.middleware_stack(scope, receive, send)
288
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 776, in app
289
- await route.handle(scope, receive, send)
290
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle
291
- await self.app(scope, receive, send)
292
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 77, in app
293
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
294
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
295
- raise exc
296
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
297
- await app(scope, receive, sender)
298
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 72, in app
299
- response = await func(request)
300
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app
301
- raw_response = await run_endpoint_function(
302
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
303
- return await dependant.call(**values)
304
- File "/usr/local/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 133, in async_wrapper
305
- return await f(*args, **kwargs)
306
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 601, in create_collection
307
- await to_thread.run_sync(
308
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
309
- return await get_async_backend().run_sync_in_worker_thread(
310
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
311
- return await future
312
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run
313
- result = context.run(func, *args)
314
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 590, in process_create_collection
315
- return self._api.create_collection(
316
- File "/usr/local/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 146, in wrapper
317
- return f(*args, **kwargs)
318
- File "/usr/local/lib/python3.10/site-packages/chromadb/api/segment.py", line 176, in create_collection
319
- coll, created = self._sysdb.create_collection(
320
- File "/usr/local/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 146, in wrapper
321
- return f(*args, **kwargs)
322
- File "/usr/local/lib/python3.10/site-packages/chromadb/db/mixins/sysdb.py", line 227, in create_collection
323
- raise UniqueConstraintError(f"Collection {name} already exists")
324
- chromadb.db.base.UniqueConstraintError: Collection Tonic-instruct already exists
325
- INFO: [11-07-2024 13:27:37] ::1:51618 - "POST /api/v1/collections?tenant=default_tenant&database=default_database HTTP/1.1" 500
326
- INFO: [11-07-2024 13:28:23] ::1:42682 - "GET /api/v1/tenants/default_tenant HTTP/1.1" 200
327
- INFO: [11-07-2024 13:28:23] ::1:42682 - "GET /api/v1/databases/default_database?tenant=default_tenant HTTP/1.1" 200
328
- ERROR: [11-07-2024 13:28:23] Resetting is not allowed by this configuration (to enable it, set `allow_reset` to `True` in your Settings() or include `ALLOW_RESET=TRUE` in your environment variables)
329
- Traceback (most recent call last):
330
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 105, in receive
331
- return self.receive_nowait()
332
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 100, in receive_nowait
333
- raise WouldBlock
334
- anyio.WouldBlock
335
-
336
- During handling of the above exception, another exception occurred:
337
-
338
- Traceback (most recent call last):
339
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 118, in receive
340
- return receiver.item
341
- AttributeError: 'MemoryObjectItemReceiver' object has no attribute 'item'
342
-
343
- During handling of the above exception, another exception occurred:
344
-
345
- Traceback (most recent call last):
346
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 159, in call_next
347
- message = await recv_stream.receive()
348
- File "/usr/local/lib/python3.10/site-packages/anyio/streams/memory.py", line 120, in receive
349
- raise EndOfStream
350
- anyio.EndOfStream
351
-
352
- During handling of the above exception, another exception occurred:
353
-
354
- Traceback (most recent call last):
355
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 76, in catch_exceptions_middleware
356
- return await call_next(request)
357
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 165, in call_next
358
- raise app_exc
359
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 151, in coro
360
- await self.app(scope, receive_or_disconnect, send_no_error)
361
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 189, in __call__
362
- with collapse_excgroups():
363
- File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
364
- self.gen.throw(typ, value, traceback)
365
- File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
366
- raise exc
367
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
368
- response = await self.dispatch_func(request, call_next)
369
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 90, in check_http_version_middleware
370
- return await call_next(request)
371
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 165, in call_next
372
- raise app_exc
373
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 151, in coro
374
- await self.app(scope, receive_or_disconnect, send_no_error)
375
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
376
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
377
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
378
- raise exc
379
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
380
- await app(scope, receive, sender)
381
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__
382
- await self.middleware_stack(scope, receive, send)
383
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 776, in app
384
- await route.handle(scope, receive, send)
385
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle
386
- await self.app(scope, receive, send)
387
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 77, in app
388
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
389
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
390
- raise exc
391
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
392
- await app(scope, receive, sender)
393
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 72, in app
394
- response = await func(request)
395
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app
396
- raw_response = await run_endpoint_function(
397
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
398
- return await dependant.call(**values)
399
- File "/usr/local/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 133, in async_wrapper
400
- return await f(*args, **kwargs)
401
- File "/usr/local/lib/python3.10/site-packages/chromadb/server/fastapi/__init__.py", line 908, in reset
402
- await to_thread.run_sync(
403
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
404
- return await get_async_backend().run_sync_in_worker_thread(
405
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
406
- return await future
407
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run
408
- result = context.run(func, *args)
409
- File "/usr/local/lib/python3.10/site-packages/chromadb/api/segment.py", line 783, in reset
410
- self._system.reset_state()
411
- File "/usr/local/lib/python3.10/site-packages/chromadb/config.py", line 430, in reset_state
412
- raise ValueError(
413
- ValueError: Resetting is not allowed by this configuration (to enable it, set `allow_reset` to `True` in your Settings() or include `ALLOW_RESET=TRUE` in your environment variables)
414
- INFO: [11-07-2024 13:28:23] ::1:42698 - "POST /api/v1/reset HTTP/1.1" 500
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
globalvars.py CHANGED
@@ -1,7 +1,7 @@
1
  ## Global Variables
2
 
3
  API_BASE = "https://api.01.ai/v1"
4
- API_KEY = "your key"
5
 
6
  model_name = 'nvidia/NV-Embed-v1'
7
 
@@ -89,4 +89,4 @@ you will recieve a text , classify the text according to the schema above. ONLY
89
 
90
  metadata_prompt = "you will recieve a text or a question, produce metadata operator pairs for the text . ONLY PROVIDE THE FINAL JSON , DO NOT PRODUCE ANY ADDITION INSTRUCTION , ONLY PRODUCE ONE METADATA STRING PER OPERATOR:"
91
 
92
- system_message = """ You are a helpful assistant named YiTonic . answer the question provided based on the context above. Produce a complete answer:"""
 
1
  ## Global Variables
2
 
3
  API_BASE = "https://api.01.ai/v1"
4
+
5
 
6
  model_name = 'nvidia/NV-Embed-v1'
7
 
 
89
 
90
  metadata_prompt = "you will recieve a text or a question, produce metadata operator pairs for the text . ONLY PROVIDE THE FINAL JSON , DO NOT PRODUCE ANY ADDITION INSTRUCTION , ONLY PRODUCE ONE METADATA STRING PER OPERATOR:"
91
 
92
+ system_message = """ You are a helpful assistant named YiTonic . answer the question provided based on the context above. Produce a complete answer:"""
requirements.txt CHANGED
@@ -14,3 +14,5 @@ libmagic
14
  # tesseract
15
  # libxml2
16
  # libxslt
 
 
 
14
  # tesseract
15
  # libxml2
16
  # libxslt
17
+ spaces
18
+ datasets
utils.py CHANGED
@@ -30,4 +30,4 @@ def parse_and_route(example_output: str):
30
  else:
31
  return {true_task: "Task description not found"}
32
  else:
33
- return "No true task found in the example output"
 
30
  else:
31
  return {true_task: "Task description not found"}
32
  else:
33
+ return "No true task found in the example output"