super-rag icon indicating copy to clipboard operation
super-rag copied to clipboard

Interpreter mode sometimes times out and throws errors

Open elisalimli opened this issue 2 years ago • 0 comments

Describe the issue

Somestimes interpreter mode doesn't work.

SAML:

workflows:
  - superagent:
      llm: gpt-4-turbo-preview
      name: Browser assistant
      intro: 👋 Hi there! How can I help search for answers on the internet.
      tools:
        - browser:
            name: browser
            use_for: searching the internet
      prompt: Use the browser to answer any questions
      superrag:
        - index:
            name: Titanic data set
            urls:
              - https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv
            use_for: Useful for answering questions about the titanic data set
            interpreter_mode: true
            database_provider: qdrant
image

Logs:

is_structured:  True interpreter_mode:  True
2024-03-08 23:36:53,402 INFO e2b.sandbox.main: Creating sandbox super-rag
2024-03-08 23:36:53,402 INFO e2b.sandbox.sandbox_connection: Sandbox for template super-rag initialized
2024-03-08 23:36:53,402 INFO e2b.sandbox.main: Opening sandbox super-rag
2024-03-08 23:36:54,347 INFO e2b.sandbox.sandbox_connection: Sandbox 1db0ceubobh88yem7h90 created (id:ibr95ulhcqhe1jao87rb1-3685e692)
2024-03-08 23:36:54,347 INFO e2b.sandbox.sandbox_connection: Started refreshing sandbox 1db0ceubobh88yem7h90 (id: ibr95ulhcqhe1jao87rb1-3685e692)
2024-03-08 23:36:54,348 INFO e2b.sandbox.sandbox_rpc: WebSocket waiting to start
2024-03-08 23:36:56,316 INFO e2b.sandbox.websocket_client: WebSocket connected to wss://49982-ibr95ulhcqhe1jao87rb1-3685e692.e2b.dev/ws
2024-03-08 23:36:56,319 INFO e2b.sandbox.sandbox_rpc: WebSocket started
2024-03-08 23:36:56,320 INFO e2b.sandbox.main: Sandbox super-rag opened
2024-03-08 23:36:56,321 INFO e2b.sandbox.process: Starting process: wget -O /code/2133580078998049921 https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv
2024-03-08 23:36:56,730 INFO e2b.sandbox.process: Started process (id: ZrF46O0mAsMB)
2024-03-08 23:36:56,868 INFO e2b.sandbox.process: Process ZrF46O0mAsMB exited with exit code 0
2024-03-08 23:36:56,868 INFO e2b.sandbox.process: Handling process exit (id: ZrF46O0mAsMB)
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 891 entries, 0 to 890
Data columns (total 12 columns):
 #   Column       Non-Null Count  Dtype
---  ------       --------------  -----
 0   PassengerId  891 non-null    int64
 1   Survived     891 non-null    int64
 2   Pclass       891 non-null    int64
 3   Name         891 non-null    object
 4   Sex          891 non-null    object
 5   Age          714 non-null    float64
 6   SibSp        891 non-null    int64
 7   Parch        891 non-null    int64
 8   Ticket       891 non-null    object
 9   Fare         891 non-null    float64
 10  Cabin        204 non-null    object
 11  Embarked     889 non-null    object
dtypes: float64(2), int64(5), object(5)
memory usage: 83.7+ KB
generated code:  import pandas as pd

df = pd.read_csv("https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv")

# Process: Filtering data for men and calculating the median age
median_age_men = df[df['Sex'] == 'male']['Age'].median()

# Output: Returning the answer as a string
answer = f"The median age among men was: {median_age_men}"
print(answer)
2024-03-08 23:37:00,180 INFO e2b.sandbox.process: Starting process: python /tmp/main-1709926619.984333.py
2024-03-08 23:37:00,637 INFO e2b.sandbox.process: Started process (id: JOul3yTqBykc)
2024-03-08 23:37:02,204 INFO e2b.sandbox.process: Process JOul3yTqBykc exited with exit code 0
2024-03-08 23:37:02,205 INFO e2b.sandbox.process: Handling process exit (id: JOul3yTqBykc)
process:  messages=[ProcessMessage(line='The median age among men was: 29.0', error=False, timestamp=1709926622252955234)] error=False exit_code=0
output:  The median age among men was: 29.0
2024-03-08 23:37:02,270 INFO e2b.sandbox.sandbox_connection: Closing sandbox 1db0ceubobh88yem7h90 (id: ibr95ulhcqhe1jao87rb1-3685e692)
2024-03-08 23:37:02,270 INFO e2b.sandbox.sandbox_connection: Sandbox closed
2024-03-08 23:37:02,270 INFO e2b.sandbox.websocket_client: WebSocket stopped
Reranking 5 documents: 100%|██████████████████| 5/5 [00:00<00:00, 132731.14it/s]
Processing reranked results : 100%|███████████| 5/5 [00:00<00:00, 185588.67it/s]
/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/pydantic/main.py:1024: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
  warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', category=PydanticDeprecatedSince20)
INFO:     127.0.0.1:64620 - "POST /api/v1/query HTTP/1.1" 200 OK
2024-03-08 23:37:05,184 INFO e2b.sandbox.sandbox_connection: Stopped refreshing sandbox (id: ibr95ulhcqhe1jao87rb1-3685e692)
2024-03-08 23:37:18 INFO semantic_router.utils.logger local
is_structured:  True interpreter_mode:  True
2024-03-08 23:37:20,894 INFO e2b.sandbox.main: Creating sandbox super-rag
2024-03-08 23:37:20,895 INFO e2b.sandbox.sandbox_connection: Sandbox for template super-rag initialized
2024-03-08 23:37:20,895 INFO e2b.sandbox.main: Opening sandbox super-rag
2024-03-08 23:37:22,547 INFO e2b.sandbox.sandbox_connection: Sandbox 1db0ceubobh88yem7h90 created (id:ibj23gqyj86unlztnoe2m-3685e692)
2024-03-08 23:37:22,547 INFO e2b.sandbox.sandbox_connection: Started refreshing sandbox 1db0ceubobh88yem7h90 (id: ibj23gqyj86unlztnoe2m-3685e692)
2024-03-08 23:37:22,548 INFO e2b.sandbox.sandbox_rpc: WebSocket waiting to start
2024-03-08 23:37:23,024 INFO e2b.sandbox.websocket_client: WebSocket connected to wss://49982-ibj23gqyj86unlztnoe2m-3685e692.e2b.dev/ws
2024-03-08 23:37:23,071 INFO e2b.sandbox.sandbox_rpc: WebSocket started
2024-03-08 23:37:23,072 INFO e2b.sandbox.main: Sandbox super-rag opened
2024-03-08 23:37:23,072 INFO e2b.sandbox.process: Starting process: wget -O /code/2133580078998049921 https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv
2024-03-08 23:37:23,516 INFO e2b.sandbox.process: Started process (id: cFchoFfS2e1Z)
2024-03-08 23:37:23,647 INFO e2b.sandbox.process: Process cFchoFfS2e1Z exited with exit code 0
2024-03-08 23:37:23,647 INFO e2b.sandbox.process: Handling process exit (id: cFchoFfS2e1Z)
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 891 entries, 0 to 890
Data columns (total 12 columns):
 #   Column       Non-Null Count  Dtype
---  ------       --------------  -----
 0   PassengerId  891 non-null    int64
 1   Survived     891 non-null    int64
 2   Pclass       891 non-null    int64
 3   Name         891 non-null    object
 4   Sex          891 non-null    object
 5   Age          714 non-null    float64
 6   SibSp        891 non-null    int64
 7   Parch        891 non-null    int64
 8   Ticket       891 non-null    object
 9   Fare         891 non-null    float64
 10  Cabin        204 non-null    object
 11  Embarked     889 non-null    object
dtypes: float64(2), int64(5), object(5)
memory usage: 83.7+ KB
generated code:  import pandas as pd

df = pd.read_csv("https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv")

# Process: Manipulating data for analysis
oldest_passenger = df.loc[df['Age'].idxmax()]['Name']

# Output: Returning the answer as a string
answer = f"The oldest passenger was: {oldest_passenger}"
answer
2024-03-08 23:37:26,584 INFO e2b.sandbox.process: Starting process: python /tmp/main-1709926646.38554.py
2024-03-08 23:37:27,103 INFO e2b.sandbox.process: Started process (id: s7DToeoD3zmE)
2024-03-08 23:37:28,698 INFO e2b.sandbox.process: Process s7DToeoD3zmE exited with exit code 0
2024-03-08 23:37:28,698 INFO e2b.sandbox.process: Handling process exit (id: s7DToeoD3zmE)
process:  messages=[] error=False exit_code=0
output:  messages=[] error=False exit_code=0
2024-03-08 23:37:28,763 INFO e2b.sandbox.sandbox_connection: Closing sandbox 1db0ceubobh88yem7h90 (id: ibj23gqyj86unlztnoe2m-3685e692)
2024-03-08 23:37:28,763 INFO e2b.sandbox.sandbox_connection: Sandbox closed
INFO:     127.0.0.1:64679 - "POST /api/v1/query HTTP/1.1" 500 Internal Server Error
2024-03-08 23:37:28,763 INFO e2b.sandbox.websocket_client: WebSocket stopped
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 412, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/middleware/cors.py", line 83, in __call__
    await self.app(scope, receive, send)
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/routing.py", line 758, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/routing.py", line 778, in app
    await route.handle(scope, receive, send)
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/routing.py", line 299, in handle
    await self.app(scope, receive, send)
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/routing.py", line 79, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/starlette/routing.py", line 74, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/fastapi/routing.py", line 299, in app
    raise e
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/api/query.py", line 11, in query
    chunks = await _query(payload=payload)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/service/router.py", line 96, in query
    return await get_documents(vector_service=vector_service, payload=payload)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/service/router.py", line 63, in get_documents
    BaseDocumentChunk(
  File "/Users/alisalimli/workspace/superagent-ai/super-rag/venv/lib/python3.11/site-packages/pydantic/main.py", line 171, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for BaseDocumentChunk
content
  Input should be a valid string [type=string_type, input_value=ProcessOutput(messages=[]...rror=False, exit_code=0), input_type=ProcessOutput]
    For further information visit https://errors.pydantic.dev/2.6/v/string_type
2024-03-08 23:37:33,625 INFO e2b.sandbox.sandbox_connection: Stopped refreshing sandbox (id: ibj23gqyj86unlztnoe2m-3685e692)

elisalimli avatar Mar 08 '24 19:03 elisalimli