diff --git a/.gitignore b/.gitignore
index e6198b72c..ca210db9a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,4 +31,3 @@ CLAUDE.md
.claude/
docs/.docusaurus/
docs/node_modules/
-docs/static/imported-files/
diff --git a/docs/README.md b/docs/README.md
index 01c6bda59..1847e49d8 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -13,19 +13,6 @@ npm run serve
```
You can open up the docs in your browser at http://localhost:3000
-## File Import System
-
-This documentation uses a custom component to import files directly from the repository, eliminating copy-paste maintenance:
-
-```jsx
-import CodeFromFile from '@site/src/components/CodeFromFile';
-
-
-
-```
-
-Files are automatically synced from the repo root when building. See the `CodeFromFile` component for syntax highlighting, line ranges, and multi-language support.
-
## Content
Try out Llama Stack's capabilities through our detailed Jupyter notebooks:
diff --git a/docs/docs/getting_started/demo_script.py b/docs/docs/getting_started/demo_script.py
index 3971ae46e..a6d7bed63 100644
--- a/docs/docs/getting_started/demo_script.py
+++ b/docs/docs/getting_started/demo_script.py
@@ -18,7 +18,7 @@ uploaded_file = client.files.create(file=(url, pseudo_file, "text/html"), purpos
client.vector_stores.files.create(vector_store_id=vs.id, file_id=uploaded_file.id)
resp = client.responses.create(
- model="gpt-4o",
+ model="openai/gpt-4o",
input="How do you do great work? Use the existing knowledge_search tool.",
tools=[{"type": "file_search", "vector_store_ids": [vs.id]}],
include=["file_search_call.results"],
diff --git a/docs/docs/getting_started/quickstart.mdx b/docs/docs/getting_started/quickstart.mdx
index 16d1e5f05..8c9b47f9c 100644
--- a/docs/docs/getting_started/quickstart.mdx
+++ b/docs/docs/getting_started/quickstart.mdx
@@ -32,36 +32,51 @@ OLLAMA_URL=http://localhost:11434 \
#### Step 3: Run the demo
Now open up a new terminal and copy the following script into a file named `demo_script.py`.
-import CodeFromFile from '@site/src/components/CodeFromFile';
+```python
+import io, requests
+from openai import OpenAI
+
+url="https://www.paulgraham.com/greatwork.html"
+client = OpenAI(base_url="http://localhost:8321/v1/", api_key="none")
+
+vs = client.vector_stores.create()
+response = requests.get(url)
+pseudo_file = io.BytesIO(str(response.content).encode('utf-8'))
+uploaded_file = client.files.create(file=(url, pseudo_file, "text/html"), purpose="assistants")
+client.vector_stores.files.create(vector_store_id=vs.id, file_id=uploaded_file.id)
+
+resp = client.responses.create(
+ model="openai/gpt-4o",
+ input="How do you do great work? Use the existing knowledge_search tool.",
+ tools=[{"type": "file_search", "vector_store_ids": [vs.id]}],
+ include=["file_search_call.results"],
+)
+
-
We will use `uv` to run the script
```
uv run --with llama-stack-client,fire,requests demo_script.py
```
And you should see output like below.
+```python
+>print(resp.output[1].content[0].text)
+To do great work, consider the following principles:
+
+1. **Follow Your Interests**: Engage in work that genuinely excites you. If you find an area intriguing, pursue it without being overly concerned about external pressures or norms. You should create things that you would want for yourself, as this often aligns with what others in your circle might want too.
+
+2. **Work Hard on Ambitious Projects**: Ambition is vital, but it should be tempered by genuine interest. Instead of detailed planning for the future, focus on exciting projects that keep your options open. This approach, known as "staying upwind," allows for adaptability and can lead to unforeseen achievements.
+
+3. **Choose Quality Colleagues**: Collaborating with talented colleagues can significantly affect your own work. Seek out individuals who offer surprising insights and whom you admire. The presence of good colleagues can elevate the quality of your work and inspire you.
+
+4. **Maintain High Morale**: Your attitude towards work and life affects your performance. Cultivating optimism and viewing yourself as lucky rather than victimized can boost your productivity. Itβs essential to care for your physical health as well since it directly impacts your mental faculties and morale.
+
+5. **Be Consistent**: Great work often comes from cumulative effort. Daily progress, even in small amounts, can result in substantial achievements over time. Emphasize consistency and make the work engaging, as this reduces the perceived burden of hard labor.
+
+6. **Embrace Curiosity**: Curiosity is a driving force that can guide you in selecting fields of interest, pushing you to explore uncharted territories. Allow it to shape your work and continually seek knowledge and insights.
+
+By focusing on these aspects, you can create an environment conducive to great work and personal fulfillment.
```
-rag_tool> Ingesting document: https://www.paulgraham.com/greatwork.html
-prompt> How do you do great work?
-
-inference> [knowledge_search(query="What is the key to doing great work")]
-
-tool_execution> Tool:knowledge_search Args:{'query': 'What is the key to doing great work'}
-
-tool_execution> Tool:knowledge_search Response:[TextContentItem(text='knowledge_search tool found 5 chunks:\nBEGIN of knowledge_search tool results.\n', type='text'), TextContentItem(text="Result 1:\nDocument_id:docum\nContent: work. Doing great work means doing something important\nso well that you expand people's ideas of what's possible. But\nthere's no threshold for importance. It's a matter of degree, and\noften hard to judge at the time anyway.\n", type='text'), TextContentItem(text="Result 2:\nDocument_id:docum\nContent: work. Doing great work means doing something important\nso well that you expand people's ideas of what's possible. But\nthere's no threshold for importance. It's a matter of degree, and\noften hard to judge at the time anyway.\n", type='text'), TextContentItem(text="Result 3:\nDocument_id:docum\nContent: work. Doing great work means doing something important\nso well that you expand people's ideas of what's possible. But\nthere's no threshold for importance. It's a matter of degree, and\noften hard to judge at the time anyway.\n", type='text'), TextContentItem(text="Result 4:\nDocument_id:docum\nContent: work. Doing great work means doing something important\nso well that you expand people's ideas of what's possible. But\nthere's no threshold for importance. It's a matter of degree, and\noften hard to judge at the time anyway.\n", type='text'), TextContentItem(text="Result 5:\nDocument_id:docum\nContent: work. Doing great work means doing something important\nso well that you expand people's ideas of what's possible. But\nthere's no threshold for importance. It's a matter of degree, and\noften hard to judge at the time anyway.\n", type='text'), TextContentItem(text='END of knowledge_search tool results.\n', type='text')]
-
-inference> Based on the search results, it seems that doing great work means doing something important so well that you expand people's ideas of what's possible. However, there is no clear threshold for importance, and it can be difficult to judge at the time.
-
-To further clarify, I would suggest that doing great work involves:
-
-* Completing tasks with high quality and attention to detail
-* Expanding on existing knowledge or ideas
-* Making a positive impact on others through your work
-* Striving for excellence and continuous improvement
-
-Ultimately, great work is about making a meaningful contribution and leaving a lasting impression.
-```
Congratulations! You've successfully built your first RAG application using Llama Stack! ππ₯³
:::tip HuggingFace access
diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts
index ab382c917..70406474f 100644
--- a/docs/docusaurus.config.ts
+++ b/docs/docusaurus.config.ts
@@ -222,7 +222,6 @@ const config: Config = {
} satisfies Preset.ThemeConfig,
plugins: [
- require.resolve('./plugins/file-sync-plugin'),
[
"docusaurus-plugin-openapi-docs",
{
diff --git a/docs/package.json b/docs/package.json
index 93b0f8280..6bbc48eb0 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -4,8 +4,8 @@
"private": true,
"scripts": {
"docusaurus": "docusaurus",
- "start": "npm run sync-files && docusaurus start",
- "build": "npm run sync-files && docusaurus build",
+ "start": "docusaurus start",
+ "build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
@@ -15,8 +15,7 @@
"gen-api-docs": "docusaurus gen-api-docs",
"clean-api-docs": "docusaurus clean-api-docs",
"gen-api-docs:version": "docusaurus gen-api-docs:version",
- "clean-api-docs:version": "docusaurus clean-api-docs:version",
- "sync-files": "node scripts/sync-files.js"
+ "clean-api-docs:version": "docusaurus clean-api-docs:version"
},
"dependencies": {
"@docusaurus/core": "3.8.1",
diff --git a/docs/scripts/sync-files.js b/docs/scripts/sync-files.js
deleted file mode 100755
index a9b5b3eaf..000000000
--- a/docs/scripts/sync-files.js
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/usr/bin/env node
-
-const fs = require('fs');
-const path = require('path');
-
-// Repository root is always one level up from docs
-const repoRoot = path.join(__dirname, '..', '..');
-
-// Get all requested files from the usage tracking file
-function getRequestedFiles() {
- const usageFile = path.join(__dirname, '..', 'static', 'imported-files', 'usage.json');
- if (!fs.existsSync(usageFile)) {
- return [];
- }
-
- try {
- const usage = JSON.parse(fs.readFileSync(usageFile, 'utf8'));
- return usage.files || [];
- } catch (error) {
- console.warn('Could not read usage file:', error.message);
- return [];
- }
-}
-
-// Track file usage
-function trackFileUsage(filePath) {
- const usageFile = path.join(__dirname, '..', 'static', 'imported-files', 'usage.json');
- const usageDir = path.dirname(usageFile);
-
- // Ensure directory exists
- if (!fs.existsSync(usageDir)) {
- fs.mkdirSync(usageDir, { recursive: true });
- }
-
- let usage = { files: [] };
- if (fs.existsSync(usageFile)) {
- try {
- usage = JSON.parse(fs.readFileSync(usageFile, 'utf8'));
- } catch (error) {
- console.warn('Could not read existing usage file, creating new one');
- }
- }
-
- if (!usage.files.includes(filePath)) {
- usage.files.push(filePath);
- fs.writeFileSync(usageFile, JSON.stringify(usage, null, 2));
- }
-}
-
-// Filter content based on file type and options
-function filterContent(content, filePath) {
- let lines = content.split('\n');
-
- // Skip copyright header for Python files
- if (filePath.endsWith('.py')) {
- // Read the license header file
- const licenseHeaderPath = path.join(repoRoot, 'docs', 'license_header.txt');
- if (fs.existsSync(licenseHeaderPath)) {
- try {
- const licenseText = fs.readFileSync(licenseHeaderPath, 'utf8');
- const licenseLines = licenseText.trim().split('\n');
-
- // Check if file starts with the license header (accounting for # comments)
- if (lines.length >= licenseLines.length) {
- let matches = true;
- for (let i = 0; i < licenseLines.length; i++) {
- const codeLine = lines[i]?.replace(/^#\s*/, '').trim();
- const licenseLine = licenseLines[i]?.trim();
- if (codeLine !== licenseLine) {
- matches = false;
- break;
- }
- }
-
- if (matches) {
- // Skip the license header and any trailing empty lines
- let skipTo = licenseLines.length;
- while (skipTo < lines.length && lines[skipTo].trim() === '') {
- skipTo++;
- }
- lines = lines.slice(skipTo);
- }
- }
- } catch (error) {
- console.warn(`Could not read license header, skipping filtering for ${filePath}`);
- }
- }
- }
-
- // Trim empty lines from start and end
- while (lines.length > 0 && lines[0].trim() === '') {
- lines.shift();
- }
- while (lines.length > 0 && lines[lines.length - 1].trim() === '') {
- lines.pop();
- }
-
- return lines.join('\n');
-}
-
-// Sync a file from repo root to static directory
-function syncFile(filePath) {
- const sourcePath = path.join(repoRoot, filePath);
- const destPath = path.join(__dirname, '..', 'static', 'imported-files', filePath);
- const destDir = path.dirname(destPath);
-
- // Ensure destination directory exists
- if (!fs.existsSync(destDir)) {
- fs.mkdirSync(destDir, { recursive: true });
- }
-
- try {
- if (fs.existsSync(sourcePath)) {
- const content = fs.readFileSync(sourcePath, 'utf8');
- const filteredContent = filterContent(content, filePath);
- fs.writeFileSync(destPath, filteredContent);
- console.log(`β
Synced ${filePath}`);
- trackFileUsage(filePath);
- return true;
- } else {
- console.warn(`β οΈ Source file not found: ${sourcePath}`);
- return false;
- }
- } catch (error) {
- console.error(`β Error syncing ${filePath}:`, error.message);
- return false;
- }
-}
-
-// Main execution
-console.log(`π Repository root: ${path.resolve(repoRoot)}`);
-
-// Get files that are being requested by the documentation
-const requestedFiles = getRequestedFiles();
-console.log(`π Syncing ${requestedFiles.length} requested files...`);
-
-if (requestedFiles.length === 0) {
- console.log('βΉοΈ No files requested yet. Files will be synced when first referenced in documentation.');
-} else {
- requestedFiles.forEach(filePath => {
- syncFile(filePath);
- });
-}
-
-console.log('β
File sync complete!');
diff --git a/docs/src/components/CodeFromFile.jsx b/docs/src/components/CodeFromFile.jsx
deleted file mode 100644
index 94580f8c5..000000000
--- a/docs/src/components/CodeFromFile.jsx
+++ /dev/null
@@ -1,93 +0,0 @@
-import React, { useState, useEffect } from 'react';
-import CodeBlock from '@theme/CodeBlock';
-
-export default function CodeFromFile({
- src,
- language = 'python',
- title,
- startLine,
- endLine,
- highlightLines
-}) {
- const [content, setContent] = useState('');
- const [error, setError] = useState(null);
-
- useEffect(() => {
- async function loadFile() {
- try {
- // File registration is now handled by the file-sync-plugin during build
-
- // Load file from static/imported-files directory
- const response = await fetch(`/imported-files/${src}`);
- if (!response.ok) {
- throw new Error(`Failed to fetch: ${response.status}`);
- }
- let text = await response.text();
-
- // Handle line range if specified (filtering is done at build time)
- if (startLine || endLine) {
- const lines = text.split('\n');
- const start = startLine ? Math.max(0, startLine - 1) : 0;
- const end = endLine ? Math.min(lines.length, endLine) : lines.length;
- text = lines.slice(start, end).join('\n');
- }
-
- setContent(text);
- } catch (err) {
- console.error('Failed to load file:', err);
- setError(`Failed to load ${src}: ${err.message}`);
- }
- }
-
- loadFile();
- }, [src, startLine, endLine]);
-
- if (error) {
- return
- Error: {error}
-
;
- }
-
- if (!content) {
- return Loading {src}...
;
- }
-
- // Auto-detect language from file extension if not provided
- const detectedLanguage = language || getLanguageFromExtension(src);
-
- return (
-
- {content}
-
- );
-}
-
-function getLanguageFromExtension(filename) {
- const ext = filename.split('.').pop();
- const languageMap = {
- 'py': 'python',
- 'js': 'javascript',
- 'jsx': 'jsx',
- 'ts': 'typescript',
- 'tsx': 'tsx',
- 'md': 'markdown',
- 'sh': 'bash',
- 'yaml': 'yaml',
- 'yml': 'yaml',
- 'json': 'json',
- 'css': 'css',
- 'html': 'html',
- 'cpp': 'cpp',
- 'c': 'c',
- 'java': 'java',
- 'go': 'go',
- 'rs': 'rust',
- 'php': 'php',
- 'rb': 'ruby',
- };
- return languageMap[ext] || 'text';
-}