| import json | |
| import os | |
| import sys | |
| sys.path.append("/Users/adriancantero/.gemini/antigravity/scratch/Lum3n/newbirth") | |
| from core.brain import call_groq_with_fallback, tools | |
| from groq import Groq | |
| client = Groq() | |
| messages = [ | |
| {"role": "system", "content": "You are a helpful assistant."}, | |
| {"role": "user", "content": "escreva um código python para hello world"}, | |
| { | |
| "role": "assistant", | |
| "content": "", | |
| "tool_calls": [ | |
| { | |
| "id": "call_123", | |
| "type": "function", | |
| "function": { | |
| "name": "delegar_programacao", | |
| "arguments": '{"tarefa": "hello world"}' | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "role": "tool", | |
| "tool_call_id": "call_123", | |
| "name": "delegar_programacao", | |
| "content": "def hello_world():\n print('hello world')\n" | |
| } | |
| ] | |
| try: | |
| final_response, _ = call_groq_with_fallback(client, { | |
| "messages": messages, | |
| "tools": tools, | |
| "tool_choice": "auto", | |
| "max_tokens": 768, | |
| "temperature": 0.7 | |
| }, "llama3-70b-8192") | |
| print("FINAL CONTENT:", final_response.choices[0].message.content) | |
| except Exception as e: | |
| print("ERROR:", e) | |