breadboard-ai / breadboard

A library for prototyping generative AI applications.
Apache License 2.0
151 stars 21 forks source link

When invalid key entered, don't add the provider #2151

Open dglazkov opened 2 months ago

dglazkov commented 2 months ago

Currently, we add the provider even if the key is invalid. It's okay, since the ACLs still work correctly and access is read-only. But it would be nice to have a better message about read-only access.

Thanks @Mearman for finding.

dglazkov commented 2 months ago

Maybe something like "Optional: skip if you only want read-only access" next to the key

Mearman commented 2 months ago

being able to select read or write would be nice for the sharing of board server instances

paullewis commented 2 months ago

I wonder if we need a /validate or /acl endpoint to fetch with both URL & key so we can report it back?

dglazkov commented 2 months ago

yup

dglazkov commented 2 months ago

So, now there's an /info API endpoint on a board server. It returns data shaped like this:

export type ServerCapabilityAccess = "open" | "key";

export type ServerCapabilityInfo = {
  path: string;
  read: ServerCapabilityAccess;
  write: ServerCapabilityAccess;
};

export type ServerCapability = "boards" | "proxy";

export type ServerInfo = {
  title?: string;
  description?: string;
  capabilities?: Partial<Record<ServerCapability, ServerCapabilityInfo>>;
};

For example:

{
  "title": "Breadboard Live!",
  "capabilities": {
    "boards": {
      "read": "open",
      "write": "key",
      "path": "/boards"
    },
    "proxy": {
      "path": "/proxy"
    }
  },
  "description": "A server hosted by Dimitri Glazkov to let his friends and colleagues collaborate and build cool boards."
}
dglazkov commented 1 month ago

@timswanson-google who is looking into this

timswanson-google commented 1 month ago

One additional note on the UX. Currently if you successfully add the board with the invalid key, and then attempt to create a board, there's no indication in the UI of what happened. The call to /boards on the board server returns a 400, and the UI doesn't do anything.