Core Concepts
Learn about the fundamental building blocks of SmartGraph, including ReactiveSmartGraph, Pipeline, and ReactiveComponent.
SmartGraph is built on a few key abstractions that work together to create powerful, flexible LLM applications. Understanding these core concepts is crucial to effectively using SmartGraph.
ReactiveSmartGraph
The ReactiveSmartGraph
class is the heart of SmartGraph. It represents the entire application structure and manages the connections between different pipelines and components.
Think of ReactiveSmartGraph
as the main application container, similar to how you might think of a React app’s root component.
Pipeline
A Pipeline
is a sequence of connected components that process data. It’s how you organize and structure your data flow within the graph.
Pipelines in SmartGraph are analogous to the way you might chain methods in a data processing library like Pandas, but with the added power of reactivity and complex branching.
ReactiveComponent
ReactiveComponent
is the base class for all components in SmartGraph. It provides the core functionality for processing input data and managing state.
Components in SmartGraph are similar to React components, but instead of rendering UI, they process data in your AI pipeline.
Putting It All Together
Here’s how these concepts work together:
- You create a
ReactiveSmartGraph
instance. - You add one or more
Pipeline
s to your graph. - You add
ReactiveComponent
s to your pipelines. - You connect components within and across pipelines as needed.
- Finally, you compile the graph and execute it.
Here’s a simple example:
In this example, we create a simple pipeline that takes text input and passes it to an LLM for completion.
Next Steps
Now that you understand the core concepts of SmartGraph, you’re ready to dive deeper into how to control the flow of data through your pipelines. Head over to the Controlling Flow section to learn more about creating dynamic workflows using pipelines and input handlers.
Was this page helpful?