| | |
| | """Test if alternative function call formats are being detected.""" |
| |
|
| | from atles.ollama_client_enhanced import OllamaFunctionCaller |
| |
|
| | def test_alternative_formats(): |
| | client = OllamaFunctionCaller() |
| | |
| | print("Testing alternative function call formats:") |
| | |
| | |
| | print("\n1. Standard FUNCTION_CALL format:") |
| | result1 = client.handle_function_call('FUNCTION_CALL:search_code:{"query": "test"}') |
| | print(f" Result: {result1[:100]}...") |
| | |
| | |
| | print("\n2. Alternative format (search_code:...):") |
| | result2 = client.handle_function_call('search_code:{"query": "test"}') |
| | print(f" Result: {result2[:100]}...") |
| | |
| | |
| | print(f"\n3. Are results the same? {result1 == result2}") |
| | |
| | |
| | print("\n4. Method detection test:") |
| | test_text = 'search_code:{"query": "test"}' |
| | lines = test_text.split('\n') |
| | detected = False |
| | for line in lines: |
| | if line.strip().startswith("FUNCTION_CALL:"): |
| | detected = True |
| | break |
| | print(f" Does 'search_code:...' start with 'FUNCTION_CALL:'? {detected}") |
| |
|
| | if __name__ == "__main__": |
| | test_alternative_formats() |
| |
|