Petite-LLM-3 / docsandtests /test_smollm3_features.py
Tonic's picture
small mods on the title and description
5975026
#!/usr/bin/env python3
"""
Test script for SmolLM3 features in the Petite Elle L'Aime 3 app
"""
import json
import sys
import os
# Add the current directory to the path so we can import from app.py
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
def test_smollm3_features():
"""Test the SmolLM3 features implementation"""
# Test tool definitions
test_tools = [
{
"name": "get_weather",
"description": "Get the weather in a city",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "The city to get the weather for"
}
}
}
}
]
print("βœ… Test tool definition format:")
print(json.dumps(test_tools, indent=2))
# Test thinking flags
test_system_prompts = [
"Tu es TonicIA, un assistant francophone rigoureux et bienveillant./think",
"Tu es TonicIA, un assistant francophone rigoureux et bienveillant./no_think",
"Tu es TonicIA, un assistant francophone rigoureux et bienveillant."
]
print("\nβœ… Test system prompts with thinking flags:")
for i, prompt in enumerate(test_system_prompts, 1):
print(f"{i}. {prompt}")
# Test generation parameters
recommended_params = {
"temperature": 0.6,
"top_p": 0.95,
"repetition_penalty": 1.1,
"max_new_tokens": 2048,
"do_sample": True
}
print("\nβœ… SmolLM3 recommended generation parameters:")
for param, value in recommended_params.items():
print(f" {param}: {value}")
print("\nβœ… SmolLM3 features implemented:")
print(" - Thinking mode with /think and /no_think flags")
print(" - Tool calling with XML and Python tools")
print(" - Recommended generation parameters")
print(" - Long context support (up to 32,768 tokens)")
print(" - Agentic usage with tool calling")
return True
if __name__ == "__main__":
test_smollm3_features()
print("\nπŸŽ‰ All SmolLM3 features are properly configured!")