Replies: 2 comments 1 reply
-
Great write-up and design! The unified declaration between built-in and user-defined resource types is a great proposal for the extendability of the Flink-Agents. At the same time, a list of the most used resource types in agentic pipelines could already be part of the built-in resource types as interfaces. |
Beta Was this translation helpful? Give feedback.
0 replies
-
The use of pemja seems to be an important enabler for the cross-language compatibility of steps in the agents. Did you consider any alternative designs or frameworks to achieve that? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
1. Introduce
This doc will introduce Resource & Resource Provider, which is an unified abstraction in Flink-Agents for all kinds of resources such as models, tools, vector_stores and so on. This abstraction can make the Runtime of Flink-Agents not need be aware of the difference among various resources, and supports lazy initialization and reuse of resources.
Sections 2, 3, and 4 will cover:
2. Concept & Interface
Resource
Resource is the abstraction of object defined in user codes, like model, tools and so on. It
Resource Provider
Resource Provider is the factory to create Resource object, it
3. API
This section will introduce how can user define their own Resource by implements Resource interface, and decalare a ResourceProvider in agent to use it.
Taking chat_model as an example.
@model
decorator indicates that thellm
method defines a model resource provider.User can get Resource instance by name and type in action, and use it.
4. How does Resource & Resource Provider work internally
This section will introduce how does Flink-Agents framework use Resource & Resource Provider, includes:
Convert factory function defined in agent to a two-level dict 'type->name->ResourceProvider' in agent plan.
5. An implementation of Resource & Resource Provider for special resource
For some kinds of resources, user may prefer define resource directly in Agent, rather than define a factory function.
Take tool as an example, user defines a python function, and the function itself is a Resource. Require user to define a factory function which returns the tool function is unreasonable.
For these kinds of resources, we provide SerializableResource & SerializableResourceProvider interface
SerializableResource
SerializableResource object should be serializable
SerializableResourceProvider
SerializableResourceProvider will return the SerializableResource object directly.
6. Resource Access Cross Language
This section will introduce the use case which may access resource cross language, and talk about the brief thought of how to solve it. In our early stage, we don't need implement this.
What is Resource Access Cross Language
Flink-Agents will provide two API, python and java, and user may mix it to reuse some action or resource defined previous. And this may lead
How to solve this problem (overall)
How to use other language defined resource in Agent
User may already implements some resource in Python or Java, and want reuse it when create and Agent use Java or Python API
Take define Java ChatModel in Python API as an example
Overall, we just store the cross language resource meta info and init arguments in compile stage, and decide whether need to create Wrapper class in runtime stage.
Beta Was this translation helpful? Give feedback.
All reactions