-
Notifications
You must be signed in to change notification settings - Fork 218
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 generated tutorial for littleX #1556
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jac is a native superset of Python that not only inherits all of Python’s features but also adds innovative constructs for data spatial programming and direct integration with large language models (LLMs). In this tutorial, you will build **littleX**—a miniature social network (think of it as a simplified Twitter/X)—using Jac’s graph-based abstractions (nodes, edges, and walkers) alongside LLM integration via the `by llm` syntax. | ||
|
||
> **Prerequisites:** | ||
> You should have a background in Python. Although Jac builds on Python, its additional graph-centric constructs and special syntax are new. Follow along step by step: type the snippets into your Jac environment and experiment with modifying or extending the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should replace mention of graph
with data-spatial
throughout the tutorial.
- [Node and Edge Filtering](https://www.jac-lang.org/for_coders/data_spatial/filtering/) cite16† | ||
|
||
And for LLM integration: | ||
- [Usage of MTLLM](https://www.jac-lang.org/for_coders/jac-mtllm/usage/) cite22† |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are these cite
stuff in this tutorial. This is auto generated and we don't need anymore. so remove these throughout.
|
||
--- | ||
|
||
## 2. Environment Setup and Global Variables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting up dependencies and imports
- The `node` keyword declares a graph node. | ||
- Attributes (like `username`) are defined using `has`. | ||
- Abilities (update, get, follow, un_follow) are attached with entry triggers. Note how graph traversal is used to find and connect Profile nodes. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This explanation is not enough. we need to expand on it.
- Explain more on
can
abilities are attached to nodes and are triggered based on walkers behavior (entry, exit, etc.) - Explain
self
vshere
- Explain the edge reference syntax
[root-->(
?profile)]` - Explain
report
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this tutorial is missing some walkers right now. The ones that are referenced here for example. So let's add them here which will also help with the explanation.
**Key Points:** | ||
- **TweetInfo** is a structured object (like a data class) holding tweet metadata. | ||
- The **Tweet node** includes abilities for updating, deleting, liking, and commenting. | ||
- Graph traversal (using edges like `+:Like():+>`) is used to manage relationships. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also need to explain
- connecting node with ++>
- Change permission with Jac.unrestrict()
|
||
**Key Points:** | ||
- **Walker Declaration:** A walker type named `visit_profile` is defined. | ||
- **Traversal with `visit`:** The walker attempts to visit a node of type `Profile` using the `visit` keyword and the traversal operator `[-->(`?Profile)]`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention that visit will visit all nodes that satisfy the filtering.
|
||
--- | ||
|
||
## 6. Special Data Spatial Syntax: Operators and Traversal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section has some content for explaining data spatial syntax but they need to be incorporated and insert into early sections (basically where I have left comments in this PR). So take the content from this section and move them up.
Description