hdresearch / nolita

Work with web-enabled agents quickly — whether running a quick task or bootstrapping a full-stack product.
https://nolita.ai
MIT License
79 stars 3 forks source link

Ty/pages new api #70

Closed AlephNotation closed 1 month ago

AlephNotation commented 1 month ago

New api for browsers and pages. This is beginning of a major change for our API structure by exposing a lower level page and browser primitive

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nolita ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 4, 2024 2:07am
matildepark commented 1 month ago

Three fails, all based around timeouts. Still wondering what's going on there...

AlephNotation commented 1 month ago

Three fails, all based around timeouts. Still wondering what's going on there...

Fixing this in the next PR

matildepark commented 1 month ago

Sometimes we get a Zod error, which I've never seen before, when trying to run the thing.

pnpm run build, node ./dist/bin/index.js --config ../config.json --objective "what's tynan's role?" --startUrl "https://hdr.is" and...

⠹ Found Tynan Daly's role on the current pageZodError: [
  {
    "code": "invalid_union",
    "unionErrors": [
      {
        "issues": [
          {
            "received": "None",
            "code": "invalid_literal",
            "expected": "Type",
            "path": [
              "command",
              0,
              "kind"
            ],
            "message": "Invalid literal value, expected \"Type\""
          },
          {
            "code": "invalid_type",
            "expected": "number",
            "received": "undefined",
            "path": [
              "command",
              0,
              "index"
            ],
            "message": "Required"
          },
          {
            "code": "invalid_type",
            "expected": "string",
            "received": "undefined",
            "path": [
              "command",
              0,
              "text"
            ],
            "message": "Required"
          }
        ],
        "name": "ZodError"
      },
      {
        "issues": [
          {
            "received": "None",
            "code": "invalid_literal",
            "expected": "Click",
            "path": [
              "command",
              0,
              "kind"
            ],
            "message": "Invalid literal value, expected \"Click\""
          },
          {
            "code": "invalid_type",
            "expected": "number",
            "received": "undefined",
            "path": [
              "command",
              0,
              "index"
            ],
            "message": "Required"
          }
        ],
        "name": "ZodError"
      },
      {
        "issues": [
          {
            "received": "None",
            "code": "invalid_literal",
            "expected": "Wait",
            "path": [
              "command",
              0,
              "kind"
            ],
            "message": "Invalid literal value, expected \"Wait\""
          }
        ],
        "name": "ZodError"
      },
      {
        "issues": [
          {
            "received": "None",
            "code": "invalid_literal",
            "expected": "Back",
            "path": [
              "command",
              0,
              "kind"
            ],
            "message": "Invalid literal value, expected \"Back\""
          }
        ],
        "name": "ZodError"
      }
    ],
    "path": [
      "command",
      0
    ],
    "message": "Invalid input"
  }
]
    at get error (/Users/am/git/standard/hdr-browser/node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/types.js:55:31)
    at ZodObject.parse (/Users/am/git/standard/hdr-browser/node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/types.js:160:22)
    at chat (/Users/am/git/standard/hdr-browser/node_modules/.pnpm/zod-gpt@0.12.1_llm-api@1.5.1_zod@3.23.8/node_modules/zod-gpt/dist/src/completion.js:128:37)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Agent._call (/Users/am/git/standard/hdr-browser/dist/agent/agent.js:119:26) {
  issues: [
    {
      code: 'invalid_union',
      unionErrors: [Array],
      path: [Array],
      message: 'Invalid input'
    }
  ],
  addIssue: [Function (anonymous)],
  addIssues: [Function (anonymous)],
  errors: [
    {
      code: 'invalid_union',
      unionErrors: [Array],
      path: [Array],
      message: 'Invalid input'
    }
  ]
}
✖ Agent failed to respond
AlephNotation commented 1 month ago

fixing

AlephNotation commented 1 month ago

I think i fixed it. I wasn't letting command be optional which seems to have done the fix. This should also fix the issue where the models find an answer and yet keep going


Debugger attached.
✔ Please specify an LLM provider for the agent · openai
✔ Please specify an LLM model for the agent · gpt-4
✔ Tynan Daly's role is in 'product, back-end'
Tynan Daly's role is in 'product, back-end'```
matildepark commented 1 month ago

Can corroborate. FTR we return the response twice there because the spinner doesn't return anything to what it's being piped to by itself, so we need to console log when we're done. I might just remove the spinner complete state so it doesn't do that, but that's separate, anyway.

matildepark commented 1 month ago

The test is failing on an invalid union, by the way.

ZodError: [
      {
        "code": "invalid_union",
        "unionErrors": [
          {
            "issues": [
              {
                "received": "type",
                "code": "invalid_literal",
                "expected": "Type",
                "path": [
                  "command",
                  0,
                  "kind"
                ],
                "message": "Invalid literal value, expected \"Type\""
              }
            ],
            "name": "ZodError"
          },
          {
            "issues": [
              {
                "received": "type",
                "code": "invalid_literal",
                "expected": "Click",
                "path": [
                  "command",
                  0,
                  "kind"
                ],
                "message": "Invalid literal value, expected \"Click\""
              }
            ],
            "name": "ZodError"
          },
          {
            "issues": [
              {
                "received": "type",
                "code": "invalid_literal",
                "expected": "Wait",
                "path": [
                  "command",
                  0,
                  "kind"
                ],
                "message": "Invalid literal value, expected \"Wait\""
              }
            ],
            "name": "ZodError"
          },
          {
            "issues": [
              {
                "received": "type",
                "code": "invalid_literal",
                "expected": "Back",
                "path": [
                  "command",
                  0,
                  "kind"
                ],
                "message": "Invalid literal value, expected \"Back\""
              }
            ],
            "name": "ZodError"
          },
          {
            "issues": [
              {
                "received": "type",
                "code": "invalid_literal",
                "expected": "Enter",
                "path": [
                  "command",
                  0,
                  "kind"
                ],
                "message": "Invalid literal value, expected \"Enter\""
              }
            ],
            "name": "ZodError"
          },
          {
            "issues": [
              {
                "received": "type",
                "code": "invalid_literal",
                "expected": "Hover",
                "path": [
                  "command",
                  0,
                  "kind"
                ],
                "message": "Invalid literal value, expected \"Hover\""
              }
            ],
            "name": "ZodError"
          },
          {
            "issues": [
              {
                "received": "type",
                "code": "invalid_literal",
                "expected": "Scroll",
                "path": [
                  "command",
                  0,
                  "kind"
                ],
                "message": "Invalid literal value, expected \"Scroll\""
              },
              {
                "expected": "'up' | 'down'",
                "received": "undefined",
                "code": "invalid_type",
                "path": [
                  "command",
                  0,
                  "direction"
                ],
                "message": "Required"
              }
            ],
            "name": "ZodError"
          }
        ],
        "path": [
          "command",
          0
        ],
        "message": "Invalid input"

type instead of Type, perhaps.

AlephNotation commented 1 month ago

Ah figured it out. the CMI was ingesting some bad memories and returning them without hints

matildepark commented 1 month ago

And should we worry about the invalid action generation we're getting sporadically? Those are, in my memory, kind of new for us. We don't usually choke on bad action generations, we usually just make it do it again, right?