mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-25 12:34:38 -07:00
feat(sdk): initial package bootstrap for SDK (#18861)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
# @google/gemini-cli-sdk
|
||||
|
||||
The Gemini CLI SDK provides a programmatic interface to interact with Gemini
|
||||
models and tools.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @google/gemini-cli-sdk
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { GeminiCliAgent } from '@google/gemini-cli-sdk';
|
||||
|
||||
async function main() {
|
||||
const agent = new GeminiCliAgent({
|
||||
instructions: 'You are a helpful assistant.',
|
||||
});
|
||||
|
||||
const controller = new AbortController();
|
||||
const signal = controller.signal;
|
||||
|
||||
// Stream responses from the agent
|
||||
const stream = agent.sendStream('Why is the sky blue?', signal);
|
||||
|
||||
for await (const chunk of stream) {
|
||||
if (chunk.type === 'content') {
|
||||
process.stdout.write(chunk.value.text || '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
```
|
||||
Reference in New Issue
Block a user