[PR #90] [CLOSED] [Do Not Merge] Use compression in file transfer #104

Closed
opened 2026-02-15 19:15:01 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/auto-evaluator/pull/90
Author: @rlancemartin
Created: 5/2/2023
Status: Closed

Base: mainHead: zip_files_transfer


📝 Commits (1)

  • 60d0e69 USe compression in file transfer

📊 Changes

5 files changed (+31 additions, -9 deletions)

View changed files

📝 api/evaluator_app.py (+19 -7)
📝 api/requirements.txt (+2 -1)
📝 nextjs/components/Playground.tsx (+4 -1)
📝 nextjs/package.json (+1 -0)
📝 nextjs/yarn.lock (+5 -0)

📄 Description

Compress files on the client prior to transfer to server.

Odd / unhelpful error b/c I can't see where specifically it is getting thrown by the server.

Logging suggests that it's never getting to here:

logger.info("*** Run Evaluator ***")
return EventSourceResponse(...)

Possible problem with the files files: List[bytes] = File(...),:

async def create_response(
    files: List[bytes] = File(...),
    num_eval_questions: int = Form(5),
    chunk_chars: int = Form(1000),
    overlap: int = Form(100),
    split_method: str = Form("RecursiveTextSplitter"),
    retriever_type: str = Form("similarity-search"),
    embeddings: str = Form("OpenAI"),
    model_version: str = Form("gpt-3.5-turbo"),
    grade_prompt: str = Form("Fast"),
    num_neighbors: int = Form(3),
    test_dataset: str = Form("[]"),
):

Trace:

  File "/Users/31treehaus/opt/anaconda3/envs/ml/lib/python3.9/site-packages/starlette/routing.py", line 680, in __call__
    await route.handle(scope, receive, send)
  File "/Users/31treehaus/opt/anaconda3/envs/ml/lib/python3.9/site-packages/starlette/routing.py", line 275, in handle
    await self.app(scope, receive, send)
  File "/Users/31treehaus/opt/anaconda3/envs/ml/lib/python3.9/site-packages/starlette/routing.py", line 65, in app
    response = await func(request)
  File "/Users/31treehaus/opt/anaconda3/envs/ml/lib/python3.9/site-packages/fastapi/routing.py", line 221, in app
    solved_result = await solve_dependencies(
  File "/Users/31treehaus/opt/anaconda3/envs/ml/lib/python3.9/site-packages/fastapi/dependencies/utils.py", line 561, in solve_dependencies
    ) = await request_body_to_args(  # body_params checked above
  File "/Users/31treehaus/opt/anaconda3/envs/ml/lib/python3.9/site-packages/fastapi/dependencies/utils.py", line 693, in request_body_to_args
    tg.start_soon(process_fn, sub_value.read)
AttributeError: 'str' object has no attribute 'read'

Problem is with FastAPI's File class:

It expects an instance of the UploadFile class, which provides a read() method to access the contents of the file.

Interesting discussion here:
https://stackoverflow.com/questions/73442335/how-to-upload-a-large-file-%E2%89%A53gb-to-fastapi-backend


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/auto-evaluator/pull/90 **Author:** [@rlancemartin](https://github.com/rlancemartin) **Created:** 5/2/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `zip_files_transfer` --- ### 📝 Commits (1) - [`60d0e69`](https://github.com/langchain-ai/auto-evaluator/commit/60d0e69c88d168c738eaaaf64015242391cd6bc9) USe compression in file transfer ### 📊 Changes **5 files changed** (+31 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `api/evaluator_app.py` (+19 -7) 📝 `api/requirements.txt` (+2 -1) 📝 `nextjs/components/Playground.tsx` (+4 -1) 📝 `nextjs/package.json` (+1 -0) 📝 `nextjs/yarn.lock` (+5 -0) </details> ### 📄 Description Compress files on the client prior to transfer to server. Odd / unhelpful error b/c I can't see where specifically it is getting thrown by the server. Logging suggests that it's never getting to here: ``` logger.info("*** Run Evaluator ***") return EventSourceResponse(...) ``` Possible problem with the files `files: List[bytes] = File(...),`: ``` async def create_response( files: List[bytes] = File(...), num_eval_questions: int = Form(5), chunk_chars: int = Form(1000), overlap: int = Form(100), split_method: str = Form("RecursiveTextSplitter"), retriever_type: str = Form("similarity-search"), embeddings: str = Form("OpenAI"), model_version: str = Form("gpt-3.5-turbo"), grade_prompt: str = Form("Fast"), num_neighbors: int = Form(3), test_dataset: str = Form("[]"), ): ``` Trace: ``` File "/Users/31treehaus/opt/anaconda3/envs/ml/lib/python3.9/site-packages/starlette/routing.py", line 680, in __call__ await route.handle(scope, receive, send) File "/Users/31treehaus/opt/anaconda3/envs/ml/lib/python3.9/site-packages/starlette/routing.py", line 275, in handle await self.app(scope, receive, send) File "/Users/31treehaus/opt/anaconda3/envs/ml/lib/python3.9/site-packages/starlette/routing.py", line 65, in app response = await func(request) File "/Users/31treehaus/opt/anaconda3/envs/ml/lib/python3.9/site-packages/fastapi/routing.py", line 221, in app solved_result = await solve_dependencies( File "/Users/31treehaus/opt/anaconda3/envs/ml/lib/python3.9/site-packages/fastapi/dependencies/utils.py", line 561, in solve_dependencies ) = await request_body_to_args( # body_params checked above File "/Users/31treehaus/opt/anaconda3/envs/ml/lib/python3.9/site-packages/fastapi/dependencies/utils.py", line 693, in request_body_to_args tg.start_soon(process_fn, sub_value.read) AttributeError: 'str' object has no attribute 'read' ``` Problem is with FastAPI's File class: It expects an instance of the `UploadFile class`, which provides a read() method to access the contents of the file. Interesting discussion here: https://stackoverflow.com/questions/73442335/how-to-upload-a-large-file-%E2%89%A53gb-to-fastapi-backend --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 19:15:01 -05:00
yindo closed this issue 2026-02-15 19:15:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/auto-evaluator#104