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

Add telephone examples, conversation RAG, and halt conditions #12

Merged
merged 5 commits into from
Feb 25, 2024

Conversation

skrawcz
Copy link
Contributor

@skrawcz skrawcz commented Feb 14, 2024

This PR is a behemoth -- we have:

  1. Telephone examples
  2. Conversational RAG examples
  3. Halt conditions

That were merged in from #25

Copy link
Contributor

@elijahbenizzy elijahbenizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just add some comments. README as well? Super simple is fine.

examples/image-telephone/application.py Outdated Show resolved Hide resolved
examples/image-telephone/application.py Outdated Show resolved Hide resolved
examples/image-telephone/application.py Outdated Show resolved Hide resolved
@skrawcz skrawcz force-pushed the add_telephone branch 2 times, most recently from a4f970c to 0b7bc6f Compare February 22, 2024 23:33
@elijahbenizzy elijahbenizzy mentioned this pull request Feb 23, 2024
24 tasks
if __name__ == "__main__":
import random

coin_flip = random.choice([True, False])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's happening here? Why are we flipping a coin then choosing (a) which one to run and (b) which way to run it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so:

  1. Have both as options, toggled by a CLI parameter or env variable. Or just have one highlighted out.
  2. Don't show both ways of running it, just use .run (have a link to the docs in which it shows how to do it, this is laid out very cleanly)
  3. Add more comments

return result, state.update(**updates).append(image_caption_history=current_caption)


@action(reads=[], writes=[])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be Result or something -- writing an empty "placeholder" is an anti-pattern. Result is meant to have a state that has a final result (E.G. the location + caption history).

ApplicationBuilder()
.with_state(
current_image_location="telephone_graph.png",
current_image_caption="",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None is better for initial state of current_image_caption

generate_images = dataflows.import_module("generate_images", "elijahbenizzy")


caption_image_driver = driver.Builder().with_config({}).with_modules(caption_images).build()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm we should really have a hub action that takes in ("caption_images", "elijahbenizzy") and delegates to Hamilton action...

if __name__ == "__main__":
import random

coin_flip = random.choice([True, False])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so:

  1. Have both as options, toggled by a CLI parameter or env variable. Or just have one highlighted out.
  2. Don't show both ways of running it, just use .run (have a link to the docs in which it shows how to do it, this is laid out very cleanly)
  3. Add more comments

skrawcz and others added 5 commits February 25, 2024 11:18
the variables were round the wrong way.
This uses the dataflows from the hub and then shows two ways
to integrate Hamilton. One via the Hamilton integration, the other
via the function API.

Also adds tracking so that we can get some nice logs of what's going on!
This one is basic and uses the off-the-shelf Hamilton
dataflow for conversational RAG. You need to supply the
knowledge for it.
So decisions:

1. we want something to stop before, and then stop after. hence halt_*.
2. step() will always result in running the action.
3. We need to run the first thing, so we don't get stuck in a
never ending loop -- this means if you know it needs inputs,
you need to pass inputs in.

This updates docs + fixes examples to demonstrate the new syntax.
Before we were repeating a lot, and arun did the wrong thing. This
ensures everything is uniform, and cleans up a lot of really big if/else
conditions to be shared utility functions. This also clarifies
documentation.
@elijahbenizzy elijahbenizzy changed the title Add telephone Add telephone examples, conversation RAG, and halt conditions Feb 25, 2024
Copy link
Contributor

@elijahbenizzy elijahbenizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skrawcz I'm approving this but I think we need to touch up the examples cause they're too complex and have too many weird options. Better to show one way we like more than two ways. Let's do that asynchronously though, because this is coupled to core features we want to release.

@elijahbenizzy elijahbenizzy merged commit d31cfad into main Feb 25, 2024
5 checks passed
@elijahbenizzy elijahbenizzy deleted the add_telephone branch February 25, 2024 19:25
@elijahbenizzy elijahbenizzy mentioned this pull request Feb 27, 2024
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

Successfully merging this pull request may close these issues.

2 participants