Template
Template(...)Description
Documentation for Template.
Real-World Examples
Practical code examples showing how Template is used in real projects.
@fused.udf
def udf():
import pandas as pd, requests, json
from jinja2 import Template
# Load common utilities for returning HTML objects
common = fused.load("https://github.com/fusedio/udfs/tree/fbf5682/public/common/")
@fused.cache
def fetch_starred_repos():
url = "https://api.github.com/search/repositories?q=stars:>10000&sort=stars&order=desc&per_page=100"
resp = requests.get(url, timeout=10)
resp.raise_for_status()
items = resp.json().get("items", [])
# Keep only a few useful columns
return pd.DataFrame([{
"name": r["full_name"],
"stars": r["stargazers_count"],
"forks": r["forks_count"],
"language": r["language"],
"url": r["html_url"]
} for r in items])
import requests
import re
import csv
import openai
import tiktoken
from string import Template
from openai import AzureOpenAI
from openai import ChatCompletion
from github import Github
from litellm import model_cost
from pydantic import BaseModel
from typing import List
from engine.base_engine import LLMEngine
def query_github_graphql(query, token):
"""
Query the GitHub GraphQL API with the provided query and authentication token.
Args:
query (str): The GraphQL query string to execute.
token (str): The GitHub personal access token for authentication.
Returns:
dict: The JSON response from the GitHub GraphQL API.