Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing relative (and especially sub-board) URLs to be invoked later #1350

Open
Tracked by #1818
dglazkov opened this issue Apr 9, 2024 · 6 comments
Open
Tracked by #1818
Assignees

Comments

@dglazkov
Copy link
Collaborator

dglazkov commented Apr 9, 2024

There are cases where we pass boards as relative URLs to be invoked later. In these cases, the base URL is no longer valid. A good example is Repeater, which is a graph that pretends to be a node in the Agent Kit. This graph takes in a "worker" input, which is a board. This input is then used to repeatedly invoke the graph, specified by the input.

When a user passes a relative URL to this graph, their expectation is that this URL is resolved relative to the graph in which Repeater is situated. However, since it is passed inside of the graph, by the time it reaches the invoke node, the base URL is now the URL of the Repeater graph.

This is especially relevant for subgraphs, because the only workaround right now is to only specify absolute URLs, which means that we could find ourselves encoding various provider-specific URLs into boards:

image

Which is no good.

Need to figure out what to do here.

@dglazkov dglazkov self-assigned this Apr 9, 2024
@dglazkov
Copy link
Collaborator Author

dglazkov commented Apr 9, 2024

One simple solution might be to lean into the BoardCapability and use it as a runtime wrapper around a board URL, supplying the base URL with it.

@paullewis
Copy link
Contributor

paullewis commented Apr 10, 2024

There's a related issue with the Board selector. If I load a board using – say – the FS API, and I select /graphs/gemini-generator.json from the list we will try and resolve to the FS API, which will fail.

Options I can think of:

  1. Expand the URL in the board selector, which has the same "we could find ourselves encoding various provider-specific URLs into boards" problem mentioned above.
  2. Denote which provider offered the board to begin with... which I guess might be a similar approach to the BoardCapability option.

@dglazkov
Copy link
Collaborator Author

Yeah, the approach i will try to day is separating compose-time and run-time URL resolution. Basically, we will use relative URLs at compose-time and resolve them into absolute URLs at run-time.

@paullewis
Copy link
Contributor

So we don't forget, this currently expands the URL in place: https://github.com/breadboard-ai/breadboard/blob/main/packages/breadboard-ui/src/elements/node-info/board-selector.ts#L182-L189

For any absolute URLs it works out because they don't get changed. For the /graph/foo.json ones, they get the current origin popped on the front.

dglazkov added a commit that referenced this issue Apr 10, 2024
…g graphs

- **Introduce `path` and `url` in `BreadboardCapability`.**
- **Add path resolution for BreadboardCapability.**
- **Somewhat working.**
- **Be more forgiving about UnresolvedPathBoardCapability.**
- **Take care of strings and undefined.**
- **docs(changeset): Split run-time and build-time URL resolutions for
loading graphs.**

Progress on #1350.
@dglazkov
Copy link
Collaborator Author

The relative URLs should now work, as long as we're not linking them across different GraphProviders. This part is trickier and still needs to be implemented.

@dglazkov
Copy link
Collaborator Author

Some incomplete notes to self on the trickier part:

  • always resolving the path to url may not always be the right thing. When I run the graph locally, the "examples"-provided URLs will resolve to localhost, which is clearly not what I want when I want to save the BGL file. Similarly, simply resolving the idb or fsapi URLs seems wrong. These aren't portable.
  • In the case of "examples", it seems like maybe there needs to be a notion of a "canonical" URL? Or maybe to simplify, example URLs need to point to github, rather than locally?
  • What is the solution that enables the user to not have to think about URLs?
  • There does seem to be some sort of bundling that will need to happen eventually. If I want to publish a BGL file, and it depends on some other files in my idb, I would probably expect Breadboard to just figure it out, and bundle those graphs when saving... right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants