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

No Agent<A>, only AI<A> #78

Merged
merged 8 commits into from
May 19, 2023
Merged

No Agent<A>, only AI<A> #78

merged 8 commits into from
May 19, 2023

Conversation

serras
Copy link
Contributor

@serras serras commented May 19, 2023

This PR goes one step further than #76 in removing the Agent abstraction altogether. "AI Agents" are now simply functions that use the shared "AI Scope". As you can see, no changes were needed in the examples.

One side benefit of this is that prompt, image, and so on, are no longer parts of the AIScope class, they are just defined as simple extensions of it.

Pinging @nomisRev @raulraja @realdavidvega for discussion

Note: the build breaks because I haven't updated the Scala code.

Copy link
Contributor

@nomisRev nomisRev left a comment

Choose a reason for hiding this comment

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

I really like it @serras! 🙌 Should we target it at my open PR, or should I close mine?

The more everything fits in the AI DSL the better IMO, this all seems to compose together than what we had before. If we can introduce @javipacheco work here for building more complex prompts I think we've gotten a nice API for core.

@serras
Copy link
Contributor Author

serras commented May 19, 2023

I didn't realize I targeted main... I'm OK with whatever, either merging this directly, or re-asigning a base branch.

Copy link
Contributor

@raulraja raulraja left a comment

Choose a reason for hiding this comment

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

This is much nicer and simpler. I guess we had names and descriptions for agents, which with functions are gone, but those were only useful for logging purposes.

@serras
Copy link
Contributor Author

serras commented May 19, 2023

This is much nicer and simpler. I guess we had names and descriptions for agents, which with functions are gone, but those were only useful for logging purposes.

I tried to keep those by defining:

interface Agent<A>: AI<A> {
  val name: String
  val description: String
}

fun agent<A>(name: String, val: String, block: AIScope.() -> A): Agent<A>

but it was too hard for the compiler to figure out what was going on in several cases. In particular, it could no longer infer the type variables in prompt, which seemed like a big loss to me.

@realdavidvega
Copy link
Contributor

I think now it's much better than before, looks more clean and also makes more sense.
Great work @serras 🙌🏻 Thank you!

@serras serras merged commit 0da8332 into main May 19, 2023
@serras serras deleted the no-agents branch May 19, 2023 15:01
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.

4 participants