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 generated tutorial for littleX #1556

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ypkang
Copy link
Contributor

@ypkang ypkang commented Feb 5, 2025

Description

Copy link
Contributor Author

@ypkang ypkang left a 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.
Copy link
Contributor Author

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/) cite16†

And for LLM integration:
- [Usage of MTLLM](https://www.jac-lang.org/for_coders/jac-mtllm/usage/) cite22†
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

  1. Explain more on can abilities are attached to nodes and are triggered based on walkers behavior (entry, exit, etc.)
  2. Explain self vs here
  3. Explain the edge reference syntax [root-->(?profile)]`
  4. Explain report

Copy link
Contributor Author

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.
Copy link
Contributor Author

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)]`.
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

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.

1 participant