-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Agent.run() can return RunResult object #1337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
f1c6fa5
Start work on run results
aymeric-roucher 46eb7c8
Create Timing and Usage objects
aymeric-roucher f4c8acb
Improve usage class, add property caculations
aymeric-roucher bbf194d
Revert deletion of step callbacks after max steps error
aymeric-roucher 962922f
Rename attributes to token_usage
aymeric-roucher 8dd6730
Update gradio UI for token usage
aymeric-roucher b076d11
Merge branch 'main' into add-run-results
aymeric-roucher 795f76e
Fix gradio chatbot as much as possible
aymeric-roucher c7be43b
Fix gradio chatbot by escaping HTML tags
aymeric-roucher 3446f7e
Pass monitoring tests
aymeric-roucher 816466a
Pass more tests
aymeric-roucher 9343611
Revert default LLM upgrade
aymeric-roucher 7a944b3
Remove sleep
aymeric-roucher 4de35e9
Re-add last_input_token_count attribute for Model
aymeric-roucher d476420
Add tests
aymeric-roucher f93846c
Pass tests
aymeric-roucher eefc8a8
Pass memory test
aymeric-roucher 55bd6c7
Pass agents test
aymeric-roucher 3b796d9
Revert model change in GAIA
aymeric-roucher 4e6b593
Update src/smolagents/models.py
aymeric-roucher 4c92beb
Update src/smolagents/monitoring.py
aymeric-roucher a87ef70
Update src/smolagents/monitoring.py
aymeric-roucher 18b1849
Revert suggestion to avoid None durations
aymeric-roucher 582a09e
Use post-init suggestion for TokenUsage, property for Timing
aymeric-roucher e25715e
Re-add deprecated token count increment in stream methods
aymeric-roucher 3a321e7
Fix dict conversion error
aymeric-roucher 6dc4c6d
Test ActionStep.dict()
aymeric-roucher 56117ad
Fix edge case
aymeric-roucher dbdb3fa
Fix even more tests
aymeric-roucher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,23 @@ | ||
| from smolagents import InferenceClientModel, LiteLLMModel, OpenAIServerModel, TransformersModel, tool | ||
| from smolagents.agents import CodeAgent, ToolCallingAgent | ||
| from smolagents import ( | ||
| CodeAgent, | ||
| InferenceClientModel, | ||
| LiteLLMModel, | ||
| OpenAIServerModel, | ||
| ToolCallingAgent, | ||
| TransformersModel, | ||
| tool, | ||
| ) | ||
|
|
||
|
|
||
| # Choose which inference type to use! | ||
|
|
||
| available_inferences = ["hf_api", "hf_api_provider", "transformers", "ollama", "litellm", "openai"] | ||
| chosen_inference = "hf_api_provider" | ||
| available_inferences = ["inference_client", "transformers", "ollama", "litellm", "openai"] | ||
| chosen_inference = "inference_client" | ||
|
|
||
| print(f"Chose model: '{chosen_inference}'") | ||
|
|
||
| if chosen_inference == "hf_api": | ||
| model = InferenceClientModel(model_id="meta-llama/Llama-3.3-70B-Instruct") | ||
|
|
||
| elif chosen_inference == "hf_api_provider": | ||
| model = InferenceClientModel(provider="together") | ||
| if chosen_inference == "inference_client": | ||
| model = InferenceClientModel(model_id="meta-llama/Llama-3.3-70B-Instruct", provider="nebius") | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specify provider "nebius" since they don't error out when using |
||
|
|
||
| elif chosen_inference == "transformers": | ||
| model = TransformersModel(model_id="HuggingFaceTB/SmolLM2-1.7B-Instruct", device_map="auto", max_new_tokens=1000) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aligns this with the new name since #1198.