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

Change GenerateText -> ComputeText #40

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pip install substrate
## Usage

```python
from substrate import Substrate, GenerateText, sb
from substrate import Substrate, ComputeText, sb
```

Initialize the Substrate client.
Expand All @@ -33,16 +33,16 @@ Initialize the Substrate client.
substrate = Substrate(api_key=SUBSTRATE_API_KEY)
```

Generate a story using the [`GenerateText`](https://www.substrate.run/nodes#GenerateText) node.
Generate a story using the [`ComputeText`](https://www.substrate.run/nodes#ComputeText) node.

```python
story = GenerateText(prompt="tell me a story")
story = ComputeText(prompt="tell me a story")
```

Summarize the output of the `story` node using another `GenerateText` node. Because `story` has not yet been run, we use `sb.concat` to work with its future output.
Summarize the output of the `story` node using another `ComputeText` node. Because `story` has not yet been run, we use `sb.concat` to work with its future output.

```python
summary = GenerateText(prompt=sb.concat("summarize this story in one sentence: ", story.future.text))
summary = ComputeText(prompt=sb.concat("summarize this story in one sentence: ", story.future.text))
```

Run the graph chaining `story` → `summary` by passing the terminal node to `substrate.run`.
Expand Down
Loading