Close Menu
  • AI
  • Content Creation
  • Tech
  • Robotics
AI-trends.todayAI-trends.today
  • AI
  • Content Creation
  • Tech
  • Robotics
Trending
  • A Group of Researchers from Columbia and CertiK Introduce TensorLean for Formal Verification of GPU Kernels
  • Collectively AI Discloses Immediate Leak After Coding Agent Uncovered Credential – Unite.AI
  • Dragos Finds Immediate Leaks and Stolen Keys in AI Provide Chains
  • Lean and Mathlib Communities Certify Claude-Assisted Riemann Proof – Unite.AI
  • AWS Routes HyperPod Inference Throughout Areas From One Endpoint – Unite.AI
  • DailyAI Briefing: A Lean-checked Riemann proof, plus 4 extra
  • Anthropic Shares Drop 8.5% in Second Session Throughout AI Selloff – Unite.AI
  • OpenAI Ships GPT-Stay-1.1 for Voice Brokers, Cuts Idle Value to $0.02/Min
AI-trends.todayAI-trends.today
Home»Tech»Microsoft Fara Tutorial – Run an OpenAI compatible Mock Endpoint with Google Colab and a Browser User Agent

Microsoft Fara Tutorial – Run an OpenAI compatible Mock Endpoint with Google Colab and a Browser User Agent

Tech By Gavin Wallace05/06/20262 Mins Read
Facebook Twitter LinkedIn Email
Can LLMs Really Judge with Reasoning? Microsoft and Tsinghua Researchers
Can LLMs Really Judge with Reasoning? Microsoft and Tsinghua Researchers
Share
Facebook Twitter LinkedIn Email
mock_server_code = r'''
FastAPI import from Fastapi, RequestSTATE =
import time
app = FastAPI()
STATE = {"calls": 0}
@app.post("/v1/chat/completions")
async def chat_completions(request: Request):
   payload = await request.json()
 STATE["calls"] += 1
   model_name = payload.get("model", "mock-fara-7b")
 If STATE["calls"] == 1:
 Content = (
           "I will open a stable public test page so the browser-control loop can be demonstrated.n"
           "{"Name":"You can also find out more about the computer by clicking here.","Anderssprachlich":{"Action":"visit_URL","url":"https://example.com"}}"
       )
   else:
 content =
           "The browser has opened Example Domain, a stable demonstration page used for documentation and examples.n"
           "{"Name":"You can also find out more about the computer by clicking here.","Considerations":{"You can also take action to help prevent the spread of HIV/AIDS.":"","Status":"SuccessReturn"}}"
       )
   return {
       "id"""chatcmpl-mock-{STATE['calls']}",
       "object": "chat.completion",
       "created": int(time.time()),
       "model": model_name,
       "choices": [
           {
               "index": 0,
               "message": {
                   "role": "assistant",
                   "content": content
               },
               "finish_reason": "stop"
           }
       ],
       "usage": {
           "prompt_tokens": 100,
           "completion_tokens": 50,
           "total_tokens": 150
       }
   }
'''
MOCK_SERVER_FILE.write_text(mock_server_code)
print(f"nMock endpoint written to: {MOCK_SERVER_FILE}")
if USE_REAL_FARA_ENDPOINT:
   endpoint_config = {
       "model": REAL_FARA_MODEL,
       "base_url": REAL_FARA_BASE_URL,
       "api_key": REAL_FARA_API_KEY,
   }
else:
   endpoint_config = {
       "model": "mock-fara-7b",
       "base_url": "http://127.0.0.1:8001/v1",
       "api_key": "not-needed",
   }
ENDPOINT_CONFIG_PATH.write_text(json.dumps(endpoint_config, indent=2))
print("nEndpoint config:")
print(ENDPOINT_CONFIG_PATH.read_text())
In this case, mock_process is None
if not USE_REAL_FARA_ENDPOINT:
   print("nStarting mock OpenAI-compatible endpoint...")
   mock_process = subprocess.Popen(
       [
           sys.executable,
           "-m",
           "uvicorn",
           "mock_fara_endpoint:app",
           "--host",
           "127.0.0.1",
           "--port",
           "8001",
       ],
       cwd=str(WORKDIR),
       stdout=subprocess.PIPE,
       stderr=subprocess.STDOUT,
       text=True,
   )
 If you do not want to wait for the port, then please don't."127.0.0.1", 8001, timeout=60):
 If mock_process is not the same as mock_process.stdout
           print(mock_process.stdout.read())
       raise RuntimeError("Mock endpoint did not start on port 8001.")
   print("Mock endpoint is running at http://127.0.0.1:8001/v1")
else:
   print("nUsing real Fara endpoint. Make sure it is reachable.")
AI ar Google microsoft openai
Share. Facebook Twitter LinkedIn Email
Avatar
Gavin Wallace

Related Posts

A Group of Researchers from Columbia and CertiK Introduce TensorLean for Formal Verification of GPU Kernels

22/11/2026

OpenAI Ships GPT-Stay-1.1 for Voice Brokers, Cuts Idle Value to $0.02/Min

21/11/2026

Meet Pondering Machines Inkling 2 Mini: 26B Looped MoE Runs on a 32GB Mac

21/11/2026

Baseten Releases Bison-1 and Groundhog-1, Topping Choice Mannequin Index

21/11/2026
Top News

Engineers will soon be able to use Vibe Coding

OpenAI Delays Launch of Newest Mannequin Over Security Issues

Why AI Isn’t More likely to Wipe Out Humanity With Bioweapons

America’s AI Chip Warfare Is Heating Up within the Dumbest Doable Methods

Nvidia Shares Fall 4.3% After Jensen Huang Quits as CEO

Load More
AI-Trends.Today

Your daily source of AI news and trends. Stay up to date with everything AI and automation!

X (Twitter) Instagram
Top Insights

You should have to work harder when applying for a job. It’s not true.

25/08/2026

Andreessen Horowitz Renames a16z Crypto, Expands Fund Past Crypto – Unite.AI

23/10/2026
Latest News

A Group of Researchers from Columbia and CertiK Introduce TensorLean for Formal Verification of GPU Kernels

22/11/2026

Collectively AI Discloses Immediate Leak After Coding Agent Uncovered Credential – Unite.AI

22/11/2026
X (Twitter) Instagram
  • Privacy Policy
  • Contact Us
  • Terms and Conditions
© 2026 AI-Trends.Today

Type above and press Enter to search. Press Esc to cancel.