Skip to content

Commit

Permalink
Fixes before release (#254)
Browse files Browse the repository at this point in the history
* Fixes before release
  • Loading branch information
aymeric-roucher authored Jan 17, 2025
1 parent a4d029d commit e3ae180
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
11 changes: 6 additions & 5 deletions docs/source/en/reference/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,22 @@ messages = [
{"role": "user", "content": "No need to help, take it easy."},
]

model = LiteLLMModel("anthropic/claude-3-5-sonnet-latest", temperature=0.2)
print(model(messages, max_tokens=10))
model = LiteLLMModel("anthropic/claude-3-5-sonnet-latest", temperature=0.2, max_tokens=10)
print(model(messages))
```

[[autodoc]] LiteLLMModel

### OpenAiServerModel

This class lets you call any OpenAIServer compatible model.
Here's how you can set it:
Here's how you can set it (you can customise the `api_base` url to point to another server):
```py
from smolagents import OpenAIServerModel

model = OpenAIServerModel(
model_id="gpt-4o",
base_url="https://api.openai.com/v1",
api_base="https://api.openai.com/v1",
api_key=os.environ["OPENAI_API_KEY"],
)
model=LiteLLMModel("gpt-4o", api_key=os.environ["OPENAI_API_KEY"])
```
4 changes: 2 additions & 2 deletions docs/source/zh/guided_tour.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ Transformers 附带了一个用于增强 agent 的默认工具箱,您可以在
您可以通过调用 [`load_tool`] 函数和要执行的任务手动使用工具。

```python
from smolagents import load_tool
from smolagents import DuckDuckGoSearchTool

search_tool = load_tool("web_search")
search_tool = DuckDuckGoSearchTool()
print(search_tool("Who's the current president of Russia?"))
```

Expand Down
4 changes: 2 additions & 2 deletions docs/source/zh/reference/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ messages = [
{"role": "user", "content": "No need to help, take it easy."},
]

model = LiteLLMModel("anthropic/claude-3-5-sonnet-latest", temperature=0.2)
print(model(messages, max_tokens=10))
model = LiteLLMModel("anthropic/claude-3-5-sonnet-latest", temperature=0.2, max_tokens=10)
print(model(messages))
```

[[autodoc]] LiteLLMModel
4 changes: 2 additions & 2 deletions examples/tool_calling_agent_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@

with ToolCollection.from_mcp(mcp_server_params) as tool_collection:
# print(tool_collection.tools[0](request={"term": "efficient treatment hangover"}))
agent = CodeAgent(tools=tool_collection.tools, model=HfApiModel())
agent.run("Find studies about hangover?")
agent = CodeAgent(tools=tool_collection.tools, model=HfApiModel(), max_steps=4)
agent.run("Find me one risk associated with drinking alcohol regularly on low doses for humans.")
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ litellm = [
"litellm>=1.55.10",
]
mcp = [
"mcpadapt>=0.0.6"
"mcpadapt>=0.0.6",
"mcp",
]
openai = [
"openai>=1.58.1"
Expand Down
2 changes: 1 addition & 1 deletion src/smolagents/e2b_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, additional_imports: List[str], tools: List[Tool], logger):
# )
# print("Installation of agents package finished.")
self.logger = logger
additional_imports = additional_imports + ["pickle5"]
additional_imports = additional_imports + ["pickle5", "smolagents"]
if len(additional_imports) > 0:
execution = self.sbx.commands.run(
"pip install " + " ".join(additional_imports)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_all_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class TestDocs:
def setup_class(cls):
cls._tmpdir = tempfile.mkdtemp()
cls.launch_args = ["python3"]
cls.docs_dir = Path(__file__).parent.parent / "docs" / "source"
cls.docs_dir = Path(__file__).parent.parent / "docs" / "source" / "en"
cls.extractor = DocCodeExtractor()

if not cls.docs_dir.exists():
Expand Down

0 comments on commit e3ae180

Please sign in to comment.