Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
4c3bbf9
Update README.md: add link to blog post
gary149 Dec 31, 2024
5fd88e5
Add support for additional keyword arguments in LiteLLMModel
chakib-belgaid Jan 1, 2025
81388b1
add device parameter to TransformerModel
ScientistIzaak Jan 2, 2025
8ec6674
feat: Add max_results kwarg to DDGS tool
Stillerman Jan 2, 2025
12ee33a
add device parameter to TransformersModel
Jan 3, 2025
e2ac275
updated logging
Jan 3, 2025
6f87aee
Merge branch 'huggingface:main' into add-device-parameter
ScientistIzaak Jan 3, 2025
7dbddb9
Merge pull request #1 from ScientistIzaak/transformer-model-device
ScientistIzaak Jan 3, 2025
3edabd8
Update tools.py
Brunwo Jan 3, 2025
ef01258
Fix typo in docs/source/en/examples/multiagents.md
oliveredget Jan 4, 2025
d7c9486
Fix typo in src/smolagents/agents.py
oliveredget Jan 4, 2025
78499e3
Fix typo in src/smolagents/local_python_executor.py
oliveredget Jan 4, 2025
4681164
Fix typo in src/smolagents/tools.py
oliveredget Jan 4, 2025
82c374a
e2b details
CakeCrusher Jan 5, 2025
6b7f75c
fix issue #69
lelayf Jan 5, 2025
5917d22
tweak comment
lelayf Jan 5, 2025
3f79bae
Add warning about missing imports in CodeAgent error logs
aymeric-roucher Jan 6, 2025
636bc87
Merge pull request #1 from huggingface/main
Brunwo Jan 6, 2025
20aa691
Clarify in guided tour where to change system prompt
aymeric-roucher Jan 6, 2025
fef210e
delete flux example notebook
lelayf Jan 6, 2025
f0fc41d
style
lelayf Jan 6, 2025
4ac9050
Fix Tool.from_hub with correct file path
aymeric-roucher Jan 6, 2025
19143af
Merge pull request #49 from ScientistIzaak/add-device-parameter
aymeric-roucher Jan 6, 2025
d704434
Merge pull request #74 from oliveredget/fix
aymeric-roucher Jan 6, 2025
f3c4edb
Remove references to transformers.agents in doc and examples
aymeric-roucher Jan 6, 2025
6520dde
Merge pull request #53 from Brunwo/main
aymeric-roucher Jan 6, 2025
4cfe4a6
Merge pull request #29 from chakib-belgaid/feature/litellm_kwargs
aymeric-roucher Jan 6, 2025
57061ba
Add system prompt modification in building_good_agents
aymeric-roucher Jan 6, 2025
7c43cb8
Update README.md
aymeric-roucher Jan 6, 2025
d742a84
Merge pull request #22 from gary149/patch-1
aymeric-roucher Jan 6, 2025
c3a11e0
Merge pull request #75 from lelayf/fix_space_tool_fwd_sig_validation
aymeric-roucher Jan 6, 2025
dbb8b7f
Fix examples/tool_calling_agent_ollama.py
aymeric-roucher Jan 6, 2025
a6a4f48
Update guided_tour.md
aymeric-roucher Jan 6, 2025
07015d1
Merge pull request #72 from CakeCrusher/CakeCrusher/guide_fixes
aymeric-roucher Jan 6, 2025
e9119c9
Replace max_iteration with max_steps for consistency
aymeric-roucher Jan 6, 2025
4a99f8b
Detail LLM choice options
aymeric-roucher Jan 6, 2025
2933ed3
Improve system prompt documentation
aymeric-roucher Jan 6, 2025
c98cd15
Further detail doc on LLM choice
aymeric-roucher Jan 6, 2025
4fa8255
Detail tool building options in guided tour
aymeric-roucher Jan 6, 2025
0824785
Add tests for multiagent hierarchies
aymeric-roucher Jan 6, 2025
ff8e20d
Don't pass sanitize_inputs_outputs=True to managed agents (#85)
grrowl Jan 6, 2025
1f24794
Delete examples/ddg_leopard.py
aymeric-roucher Jan 6, 2025
e8617b3
Finalize multiagent tests
aymeric-roucher Jan 6, 2025
eae4b6f
Merge pull request #40 from Stillerman/main
aymeric-roucher Jan 6, 2025
5de8d44
Fixed grammatical errors in building_good_agents.md tutorial
alxfgh Jan 6, 2025
10fee97
Update test workflows
aymeric-roucher Jan 6, 2025
417c668
Fix quality.yml
aymeric-roucher Jan 6, 2025
c22feda
Sort imports and add test workflows
aymeric-roucher Jan 6, 2025
01abe59
Add accelerate to test requirements
aymeric-roucher Jan 6, 2025
d45c635
Pass more tests
aymeric-roucher Jan 6, 2025
c47ea60
Remove tests on test_utils.py
aymeric-roucher Jan 6, 2025
1f11b95
Include missing pip install library
DarwinAnim8or Jan 6, 2025
b135372
Merge pull request #89 from alxfgh/fix-doc-tutorial-errors
aymeric-roucher Jan 6, 2025
723582a
Update rag.md
aymeric-roucher Jan 6, 2025
dd2896e
Merge pull request #92 from DarwinAnim8or/patch-1
aymeric-roucher Jan 6, 2025
58d25ac
Clarify warning for missing imports
aymeric-roucher Jan 6, 2025
e0ff435
Merge branch 'main' of github.com:huggingface/smolagents
aymeric-roucher Jan 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,33 @@ name: Quality Check
on: [pull_request]

jobs:
quality:
check_code_quality:
runs-on: ubuntu-latest
env:
UV_HTTP_TIMEOUT: 600 # max 10min to install deps

steps:
- uses: actions/[email protected]
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.10
cache: 'pip'
cache-dependency-path: 'setup.py'
- name: Install Python dependencies
run: pip install -e .[quality]
- name: Run Quality check
run: make quality
- name: Check if failure
if: ${{ failure() }}
run: |
echo "Quality check failed. Please ensure the right dependency versions are installed with 'pip install -e .[quality]' and rerun 'make style; make quality;'" >> $GITHUB_STEP_SUMMARY
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

# Setup venv
# TODO: revisit when https://github.com/astral-sh/uv/issues/1526 is addressed.
- name: Setup venv + uv
run: |
pip install --upgrade uv
uv venv

- name: Install dependencies
run: uv pip install "smolagents[test] @ ."
- run: uv run ruff check tests src # linter
- run: uv run ruff format --check tests src # formatter

# Run type checking at least on smolagents root file to check all modules
# that can be lazy-loaded actually exist.
# - run: uv run mypy src/smolagents/__init__.py --follow-imports=silent --show-traceback

# Run mypy on full package
# - run: uv run mypy src
59 changes: 59 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Python tests

on: [pull_request]

jobs:
build-ubuntu:
runs-on: ubuntu-latest
env:
UV_HTTP_TIMEOUT: 600 # max 10min to install deps

strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.12"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}


# Setup venv
# TODO: revisit when https://github.com/astral-sh/uv/issues/1526 is addressed.
- name: Setup venv + uv
run: |
pip install --upgrade uv
uv venv

# Install dependencies
- name: Install dependencies
run: |
uv pip install "smolagents[test] @ ."

- name: Agent tests
run: |
uv run pytest -sv ./tests/test_agents.py
- name: Final answer tests
run: |
uv run pytest -sv ./tests/test_final_answer.py
- name: Models tests
run: |
uv run pytest -sv ./tests/test_models.py
- name: Monitoring tests
run: |
uv run pytest -sv ./tests/test_monitoring.py
- name: Python interpreter tests
run: |
uv run pytest -sv ./tests/test_python_interpreter.py
- name: Search tests
run: |
uv run pytest -sv ./tests/test_search.py
- name: Tools tests
run: |
uv run pytest -sv ./tests/test_tools.py
- name: Types tests
run: |
uv run pytest -sv ./tests/test_types.py
18 changes: 18 additions & 0 deletions .github/workflows/trufflehog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
push:

name: Secret Leaks

permissions:
contents: read

jobs:
trufflehog:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Secret Scanning
uses: trufflesecurity/trufflehog@main
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ limitations under the License.

🌐 **Support for any LLM**: it supports models hosted on the Hub loaded in their `transformers` version or through our inference API, but also supports models from OpenAI, Anthropic and many others via our [LiteLLM](https://www.litellm.ai/) integration.

> [!NOTE]
> Check the our [launch blog post](https://huggingface.co/blog/smolagents) to learn more about `smolagents`!

## Quick demo

First install the package.
Expand Down
6 changes: 3 additions & 3 deletions docs/source/en/examples/multiagents.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Now that we have all the tools `search` and `visit_webpage`, we can use them to

Which configuration to choose for this agent?
- Web browsing is a single-timeline task that does not require parallel tool calls, so JSON tool calling works well for that. We thus choose a `JsonAgent`.
- Also, since sometimes web search requires exploring many pages before finding the correct answer, we prefer to increase the number of `max_iterations` to 10.
- Also, since sometimes web search requires exploring many pages before finding the correct answer, we prefer to increase the number of `max_steps` to 10.

```py
from smolagents import (
Expand All @@ -137,7 +137,7 @@ model = HfApiModel(model_id)
web_agent = ToolCallingAgent(
tools=[DuckDuckGoSearchTool(), visit_webpage],
model=model,
max_iterations=10,
max_steps=10,
)
```

Expand Down Expand Up @@ -169,7 +169,7 @@ manager_agent = CodeAgent(
That's all! Now let's run our system! We select a question that requires both some calculation and research:

```py
answer = manager_agent.run("If LLM trainings continue to scale up at the current rythm until 2030, what would be the electric power in GW required to power the biggest training runs by 2030? What does that correspond to, compared to some contries? Please provide a source for any number used.")
answer = manager_agent.run("If LLM trainings continue to scale up at the current rhythm until 2030, what would be the electric power in GW required to power the biggest training runs by 2030? What does that correspond to, compared to some contries? Please provide a source for any number used.")
```

We get this report as the answer:
Expand Down
4 changes: 2 additions & 2 deletions docs/source/en/examples/rag.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Let's build this system. 🛠️

Run the line below to install required dependencies:
```bash
!pip install smolagents pandas langchain langchain-community sentence-transformers faiss-cpu --upgrade -q
!pip install smolagents pandas langchain langchain-community sentence-transformers rank_bm25 --upgrade -q
```
To call the HF Inference API, you will need a valid token as your environment variable `HF_TOKEN`.
We use python-dotenv to load it.
Expand Down Expand Up @@ -137,7 +137,7 @@ _Note:_ The Inference API hosts models based on various criteria, and deployed m
from smolagents import HfApiModel, CodeAgent

agent = CodeAgent(
tools=[retriever_tool], model=HfApiModel("meta-llama/Llama-3.3-70B-Instruct"), max_iterations=4, verbose=True
tools=[retriever_tool], model=HfApiModel("meta-llama/Llama-3.3-70B-Instruct"), max_steps=4, verbose=True
)
```

Expand Down
2 changes: 1 addition & 1 deletion docs/source/en/examples/text_to_sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def sql_engine(query: str) -> str:

Now let us create an agent that leverages this tool.

We use the `CodeAgent`, which is transformers.agents’ main agent class: an agent that writes actions in code and can iterate on previous output according to the ReAct framework.
We use the `CodeAgent`, which is smolagents’ main agent class: an agent that writes actions in code and can iterate on previous output according to the ReAct framework.

The model is the LLM that powers the agent system. HfApiModel allows you to call LLMs using HF’s Inference API, either via Serverless or Dedicated endpoint, but you could also use any proprietary API.

Expand Down
Loading
Loading