Skip to content

Commit 5b74f94

Browse files
committed
docs: Add Syncing Files section to README
1 parent 529c25c commit 5b74f94

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,47 @@ try {
9191
}
9292
```
9393

94+
## Store Humanloop Files in Code
95+
96+
Humanloop allows you to maintain Prompts and Agents in your local filesystem and version control, while still leveraging Humanloop's prompt management capabilities.
97+
98+
### Syncing Files with the CLI
99+
100+
```bash
101+
# Basic usage
102+
npx humanloop pull # Pull all files to 'humanloop/' directory
103+
npx humanloop pull --path="examples/chat" # Pull specific directory
104+
npx humanloop pull --environment="production" # Pull from specific environment
105+
npx humanloop pull --local-files-directory="ai" # Specify local destination (default: "humanloop")
106+
107+
# View available options
108+
npx humanloop pull --help
109+
```
110+
111+
### Using Local Files in the SDK
112+
113+
To use local Files in your code:
114+
115+
```typescript
116+
// Enable local file support
117+
const client = new HumanloopClient({
118+
apiKey: "YOUR_API_KEY",
119+
useLocalFiles: true
120+
});
121+
122+
// Call a local Prompt file
123+
const response = await client.prompts.call({
124+
path: "examples/chat/basic", // Looks for humanloop/examples/chat/basic.prompt
125+
inputs: { query: "Hello world" }
126+
});
127+
128+
// The same path-based approach works with prompts.log(), agents.call(), and agents.log()
129+
```
130+
131+
For detailed instructions, see our [Guide on Storing Files in Code](https://humanloop.com/docs/v5/guides/prompts/store-prompts-in-code).
132+
133+
For information about file formats, see our [File Format Reference](https://humanloop.com/docs/v5/reference/serialized-files).
134+
94135
## Pagination
95136

96137
List endpoints are paginated. The SDK provides an iterator so that you can simply loop over the items:

0 commit comments

Comments
 (0)