Image
Image
| import json | |
| from textwrap import dedent | |
| from typing import Literal | |
| from openai import AsyncAzureOpenAI, DefaultAioHttpClient | |
| from openai.lib._pydantic import to_strict_json_schema | |
| from pydantic import BaseModel, Field | |
| from config import settings |
| from functools import wraps | |
| from pathlib import Path | |
| from typing import Any, Literal, NamedTuple | |
| import joblib | |
| import numpy as np | |
| import polars as pl | |
| from hummingbird.ml import convert, load | |
| from sklearn.pipeline import Pipeline | |
| from sklearn.preprocessing import LabelEncoder |
| import asyncio | |
| import inspect | |
| class Depends: | |
| _cache = {} | |
| def __init__(self, dependency): | |
| self._dependency = dependency | |
| self._resolved = None |
| from os import environ | |
| from smolagents import CodeAgent, LiteLLMModel, MCPClient | |
| model = LiteLLMModel( | |
| model_id="anthropic/claude-opus-4-5-20251101", | |
| temperature=0.2, | |
| api_key=environ.get("ANTHROPIC_API_KEY"), | |
| ) |
| import httpx | |
| def get_coordinates(query: str) -> tuple[float, float]: | |
| """Return (latitude, longitude) for a given address in Denmark query.""" | |
| base_url = "https://nominatim.openstreetmap.org" | |
| params = { | |
| "q": query, | |
| "format": "json", | |
| "polygon_kml": 1, |
| from fastmcp import FastMCP | |
| from fastmcp.server.auth.providers.jwt import StaticTokenVerifier | |
| from agents.tools import get_coordinates, get_dmi_weather | |
| # define autheticifacation mechanism | |
| verifier = StaticTokenVerifier( | |
| tokens={ | |
| "generatedtoken": { | |
| "client_id": "prayson@42.com", |
| import ibis | |
| conn = ibis.connect("duckdb://") # bigguery://, snowfalke://, etc | |
| # load penguin data | |
| penguins = conn.read_csv( | |
| "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/penguins.csv" | |
| ) | |
| # query: find female penguins heavier than their species average |
| from typing import NamedTuple | |
| import httpx | |
| from smolagents import CodeAgent, LiteLLMModel, Tool | |
| class Coordinates(NamedTuple): | |
| latitude: float | |
| longitude: float | |
| from typing import NamedTuple | |
| from smolagents import CodeAgent, LiteLLMModel, Tool | |
| class Coordinates(NamedTuple): | |
| latitude: float | |
| longitude: float | |
| model = LiteLLMModel( |