diff --git a/README.md b/README.md index 4ba9f24..781e733 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ python -m freeact.cli \ --skill-modules=freeact_skills.search.google.stream.api ``` -or an equivalent [quickstart.py](freeact/examples/quickstart.py) script: +or an equivalent [quickstart.py](examples/quickstart.py) script: ```python import asyncio diff --git a/docs/integration.md b/docs/integration.md index 21e25e9..6ca0e74 100644 --- a/docs/integration.md +++ b/docs/integration.md @@ -39,8 +39,8 @@ Although we could instantiate `GenericModel` directly with these prompt template Here's a Python example that uses `QwenCoder` as code action model in a `freeact` agent. The model is accessed via the Hugging Face Inference API: -```python title="freeact/examples/qwen.py" ---8<-- "freeact/examples/qwen.py" +```python title="examples/qwen.py" +--8<-- "examples/qwen.py" ``` 1. Your Hugging Face [user access token](https://huggingface.co/docs/hub/en/security-tokens) diff --git a/docs/quickstart.md b/docs/quickstart.md index 43017df..82d1ee9 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -27,8 +27,8 @@ python -m freeact.cli \ or an equivalent Python script: -```python title="freeact/examples/quickstart.py" ---8<-- "freeact/examples/quickstart.py" +```python title="examples/quickstart.py" +--8<-- "examples/quickstart.py" ``` Once launched, you can start interacting with the agent: diff --git a/docs/tutorials/basics.md b/docs/tutorials/basics.md index a7d561d..1fe593f 100644 --- a/docs/tutorials/basics.md +++ b/docs/tutorials/basics.md @@ -7,14 +7,14 @@ A `freeact` agent system consists of: - A code action model that generates *code actions* to be executed by the executor. Models must implement the interfaces defined in the [`freeact.model`](../api/model.md) package. This tutorial uses [`Claude`][freeact.model.claude.model.Claude], configured with `claude-3-5-sonnet-20241022` as model name. - A [`CodeActAgent`][freeact.agent.CodeActAgent] configured with both the model and executor. It orchestrates their interaction until a final response is ready. -```python title="freeact/examples/basics.py" ---8<-- "freeact/examples/basics.py" +```python title="examples/basics.py" +--8<-- "examples/basics.py" ``` 1. -```python title="freeact/examples/utils.py::stream_conversation" ---8<-- "freeact/examples/utils.py:stream_conversation" ---8<-- "freeact/examples/utils.py:stream_turn" +```python title="examples/utils.py::stream_conversation" +--8<-- "examples/utils.py:stream_conversation" +--8<-- "examples/utils.py:stream_turn" ``` 2. Tag of the `ipybox` Docker image. @@ -35,9 +35,9 @@ A `CodeActAgent` can engage in multi-turn conversations with a user. Each turn i { .annotate } 1. -```python title="freeact/examples/utils.py::stream_conversation" ---8<-- "freeact/examples/utils.py:stream_conversation" ---8<-- "freeact/examples/utils.py:stream_turn" +```python title="examples/utils.py::stream_conversation" +--8<-- "examples/utils.py:stream_conversation" +--8<-- "examples/utils.py:stream_turn" ``` This tutorial uses the `freeact_skills.search.google.stream.api` skill module from the [`freeact-skills`](https://gradion-ai.github.io/freeact-skills/) project to process queries that require internet searches. This module provides generative Google search capabilities powered by the Gemini 2 API. @@ -63,22 +63,30 @@ The tutorials use the prebuilt [`ghcr.io/gradion-ai/ipybox:example`](../environm ## Running -The Python example above is part of the `freeact` package and can be run with: +Download the Python example ```shell -python -m freeact.examples.basics +mkdir examples +curl -o examples/basics.py https://raw.githubusercontent.com/gradion-ai/freeact/refs/heads/main/freeact/examples/basics.py +curl -o examples/utils.py https://raw.githubusercontent.com/gradion-ai/freeact/refs/heads/main/freeact/examples/utils.py +``` + +and run it with: + +```shell +python examples/basics.py ``` For formatted and colored console output, as shown in the [example conversation](#example-conversation), you can use the `freeact` [CLI](../cli.md): ```shell ---8<-- "freeact/examples/commands.txt:cli-basics-claude" +--8<-- "examples/commands.txt:cli-basics-claude" ``` To use Gemini instead of Claude, run: ```shell ---8<-- "freeact/examples/commands.txt:cli-basics-gemini" +--8<-- "examples/commands.txt:cli-basics-gemini" ``` See also [Supported models](../models.md) for other CLI examples. diff --git a/docs/tutorials/extend.md b/docs/tutorials/extend.md index 743a63f..56b8149 100644 --- a/docs/tutorials/extend.md +++ b/docs/tutorials/extend.md @@ -12,13 +12,13 @@ This tutorial demonstrates how `freeact` agents can be customized through system The [example conversation](#example-conversation) below was guided by this system extension: ```text title="extension.txt" ---8<-- "freeact/examples/extension.txt" +--8<-- "examples/extension.txt" ``` It was initiated with the following `freeact.cli` command, referencing the `extension.txt` file with the `--system-extension` option and reusing the developed `weather.weather_report` skill from the [Skill development](skills.md) tutorial. ```shell ---8<-- "freeact/examples/commands.txt:cli-extension" +--8<-- "examples/commands.txt:cli-extension" ``` ### Example conversation diff --git a/docs/tutorials/skills.md b/docs/tutorials/skills.md index 831128b..efb2a00 100644 --- a/docs/tutorials/skills.md +++ b/docs/tutorials/skills.md @@ -38,7 +38,7 @@ The [example conversation](#example-conversation) below was initiated with the f [^1]: The provided skill modules are not needed in this example but included to demonstrate that their usage is optional. ```shell ---8<-- "freeact/examples/commands.txt:cli-skills" +--8<-- "examples/commands.txt:cli-skills" ``` ### Example conversation @@ -64,7 +64,7 @@ The example shows a request for weather data from Paris and Berlin, where the ag The example conversation was initiated with the following `freeact.cli` command. The developed skill is is read from `workspace/skills/private/example`. If we moved it to `workspace/skills/shared`, it would be available to all executors regardless of their `executor-key` value. ```shell ---8<-- "freeact/examples/commands.txt:cli-skills-weather" +--8<-- "examples/commands.txt:cli-skills-weather" ``` !!! Note diff --git a/freeact/examples/__init__.py b/examples/__init__.py similarity index 100% rename from freeact/examples/__init__.py rename to examples/__init__.py diff --git a/freeact/examples/basics.py b/examples/basics.py similarity index 95% rename from freeact/examples/basics.py rename to examples/basics.py index 96fde1f..c6fd18e 100644 --- a/freeact/examples/basics.py +++ b/examples/basics.py @@ -3,13 +3,13 @@ from dotenv import load_dotenv +from examples.utils import stream_conversation from freeact import ( Claude, CodeActAgent, CodeExecutionContainer, CodeExecutor, ) -from freeact.examples.utils import stream_conversation from freeact.logger import Logger diff --git a/freeact/examples/commands.txt b/examples/commands.txt similarity index 100% rename from freeact/examples/commands.txt rename to examples/commands.txt diff --git a/freeact/examples/extension.txt b/examples/extension.txt similarity index 100% rename from freeact/examples/extension.txt rename to examples/extension.txt diff --git a/freeact/examples/quickstart.py b/examples/quickstart.py similarity index 100% rename from freeact/examples/quickstart.py rename to examples/quickstart.py diff --git a/freeact/examples/qwen.py b/examples/qwen.py similarity index 100% rename from freeact/examples/qwen.py rename to examples/qwen.py diff --git a/freeact/examples/utils.py b/examples/utils.py similarity index 100% rename from freeact/examples/utils.py rename to examples/utils.py