You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some reason, in rest_api/sources/index.py, method load_file_to_source receives the file already closed. I was able to get around it by reading bytes in enclosing method upload_file_to_source, and passing them through add_task as below:
defload_file_to_source(server: SyncServer, user_id: uuid.UUID, source: Source, job_id: uuid.UUID,
file: UploadFile,
bytes: bytes<------
):
# update job statusjob=server.ms.get_job(job_id=job_id)
job.status=JobStatus.runningserver.ms.update_job(job)
try:
# write the file to a temporary directory (deleted after the context manager exits)withtempfile.TemporaryDirectory() astmpdirname:
file_path=os.path.join(tmpdirname, file.filename)
withopen(file_path, "wb") asbuffer:
buffer.write(bytes) <-----
Describe the bug
upload sources file error "I/O operation on closed file"
Please describe your setup
pip install pymemgpt-nightly
andgit clone
run logs
INFO: 127.0.0.1:42014 - "GET /api/agents HTTP/1.1" 200 OK
INFO: 127.0.0.1:42014 - "GET /api/sources HTTP/1.1" 200 OK
INFO: 127.0.0.1:42014 - "POST /api/sources/af96f667-f50d-480b-96a9-34324bc0c4ab/upload HTTP/1.1" 200 OK
I/O operation on closed file.
MemGPT Config
~/.memgpt/config
file :[defaults]
preset = memgpt_chat
persona = sam_pov
human = basic
[model]
model = wizardlm2:7b
model_endpoint = http://10.60.84.95:11434
model_endpoint_type = ollama
model_wrapper = chatml
context_window = 8192
[embedding]
embedding_endpoint_type = hugging-face
embedding_endpoint = http://10.60.84.95:11434
embedding_model = nomic-embed-text:latest
embedding_dim = 384
embedding_chunk_size = 300
[archival_storage]
type = chroma
path = /home/cm/.memgpt/chroma
uri = postgresql+pg8000://memgpt:memgpt@localhost:5432/memgpt
[recall_storage]
type = sqlite
path = /home/cm/.memgpt
uri = postgresql+pg8000://memgpt:memgpt@localhost:5432/memgpt
[metadata_storage]
type = sqlite
path = /home/cm/.memgpt
uri = postgresql+pg8000://memgpt:memgpt@localhost:5432/memgpt
[version]
memgpt_version = 0.3.14
[client]
anon_clientid = 00000000-0000-0000-0000-000000000000
The text was updated successfully, but these errors were encountered: