Skip to content

Commit 12f2043

Browse files
committed
Updating docs and adding github workflow to deploy docs to github pages
1 parent 120c1d6 commit 12f2043

File tree

7 files changed

+99
-9
lines changed

7 files changed

+99
-9
lines changed

.github/workflows/deploy.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Sample workflow for building and deploying a VitePress site to GitHub Pages
2+
#
3+
name: Deploy VitePress site to Pages
4+
5+
on:
6+
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
7+
# using the `master` branch as the default branch.
8+
push:
9+
branches: [docs]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
20+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
21+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
22+
concurrency:
23+
group: pages
24+
cancel-in-progress: false
25+
26+
jobs:
27+
# Build job
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0 # Not needed if lastUpdated is not enabled
35+
# - uses: pnpm/action-setup@v3 # Uncomment this block if you're using pnpm
36+
# with:
37+
# version: 9 # Not needed if you've set "packageManager" in package.json
38+
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
39+
- name: Setup Node
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: 22
43+
cache: npm # or pnpm / yarn
44+
- name: Setup Pages
45+
uses: actions/configure-pages@v4
46+
- name: Install dependencies
47+
run: npm ci # or pnpm install / yarn install / bun install
48+
- name: Build with VitePress
49+
run: npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
50+
- name: Upload artifact
51+
uses: actions/upload-pages-artifact@v3
52+
with:
53+
path: docs/.vitepress/dist
54+
55+
# Deployment job
56+
deploy:
57+
environment:
58+
name: github-pages
59+
url: ${{ steps.deployment.outputs.page_url }}
60+
needs: build
61+
runs-on: ubuntu-latest
62+
name: Deploy
63+
steps:
64+
- name: Deploy to GitHub Pages
65+
id: deployment
66+
uses: actions/deploy-pages@v4
Lines changed: 21 additions & 0 deletions
Loading

docs/.vitepress/config.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitepress'
33
import {
44
groupIconMdPlugin,
55
groupIconVitePlugin,
6+
localIconLoader,
67
} from "vitepress-plugin-group-icons"
78

89
// https://vitepress.dev/reference/site-config
@@ -20,6 +21,7 @@ export default defineConfig({
2021
anthropic: 'logos:anthropic-icon',
2122
google: 'logos:google-icon',
2223
ollama: 'simple-icons:ollama',
24+
openrouter: localIconLoader(import.meta.url, './assets/icons/openrouter.svg'),
2325
}
2426
}),
2527
],

docs/docs/active-agent/callbacks.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class ApplicationAgent < ActiveAgent::Base
4646
generate_with :openai
4747

4848
before_action :set_context
49+
4950
private
5051
def set_context
5152
# Logic to set the context for the action, e.g., setting a user ID or session data
@@ -62,7 +63,8 @@ Generation callbacks are executed during the generation process of an agent. Thi
6263
class ApplicationAgent < ActiveAgent::Base
6364
generate_with :openai
6465

65-
after_generate :process_response
66+
after_generation :process_response
67+
6668
private
6769
def process_response
6870
generation_provider.response

docs/docs/active-agent/generation.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ The prompt generation cycle is similar to the request-response cycle of Action C
1717
6. **Updated Context**: The context is updated with the new messages, actions, and parameters, and the cycle continues.
1818
## Prompt Context
1919
Action Prompt renders prompt context objects that represent the contextual data and runtime parameters for the generation process. Prompt context objects contain messages, actions, and params that are passed in the request to the agent's generation provider. The context object is responsible for managing the contextual history and providing the necessary information for prompt and response cycles.
20+
21+
2022
## Example Prompt Generation
2123

2224
```ruby
@@ -33,6 +35,7 @@ response = ApplicationAgent.text_prompt(messages: response.prompt.messages).gene
3335
Generation can be performed using Active Job to handle the prompt-generation and perform actions asynchronously. This is the most common way to handle generation in production applications, as it allows for better scalability and responsiveness.
3436

3537
To perform queued generation, you can use the `generate_later` method, which enqueues the generation job to be processed later by Active Job.
38+
3639
```ruby
3740
response = ApplicationAgent.text_prompt(message: params[:message], messages: response.prompt.messages).generate_later
3841
```

docs/docs/framework/active-agent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Agents are Controllers that act as the core of the Active Agent framework. They
99

1010
## Example
1111
```ruby
12-
class TravelAgent < ActiveAgent::Base
12+
class TravelAgent < ApplicationAgent
1313
def search
1414
prompt(message: params[:message], content_type: :html)
1515
end

docs/docs/framework/generation-provider.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ Generation Providers are the backbone of the Active Agent framework, allowing se
44

55
::: code-group
66

7-
```ruby [OpenAI]
8-
class ApplicationAgent < ActiveAgent::Base
9-
generate_with :openai
10-
end
11-
```
7+
<<< @/../test/dummy/app/agents/open_ai_agent.rb#snippet{ruby:line-numbers} [OpenAI]
128

139
```ruby [Anthropic]
1410
class ApplicationAgent < ActiveAgent::Base
@@ -22,8 +18,8 @@ class ApplicationAgent < ActiveAgent::Base
2218
end
2319
```
2420

25-
<<< @/../test/dummy/app/agents/open_router_agent.rb#snippet{ruby:line-numbers} [openrouter]
21+
<<< @/../test/dummy/app/agents/open_router_agent.rb#snippet{ruby:line-numbers} [OpenRouter]
2622

27-
<<< @/../test/dummy/app/agents/ollama_agent.rb#snippet{ruby:line-numbers} [ollama]
23+
<<< @/../test/dummy/app/agents/ollama_agent.rb#snippet{ruby:line-numbers} [Ollama]
2824

2925
:::

0 commit comments

Comments
 (0)