This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# requires-python = ">=3.11" | |
# dependencies = [ | |
# "genai-processors", | |
# ] | |
# /// | |
import asyncio | |
import os | |
from genai_processors import content_api, processor, streams |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2025 ftnext | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shows how to call all the sub-agents using the LLM's reasoning ability. Run this with "adk run" or "adk web" | |
from pathlib import Path | |
from google.adk.agents import LlmAgent | |
from google.adk.tools import google_search | |
from google.adk.tools.agent_tool import AgentTool | |
def load_instruction_from_file(filename: str) -> str: | |
"""Reads instruction text from a file relative to this script.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# uvx --from google-adk --with litellm adk web | |
from pathlib import Path | |
from google.adk.agents import LlmAgent | |
from google.adk.models.lite_llm import LiteLlm | |
from google.adk.tools import google_search | |
from google.adk.tools.agent_tool import AgentTool | |
def load_instruction_from_file(filename: str) -> str: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# requires-python = ">=3.12" | |
# dependencies = [ | |
# "openai", | |
# "langsmith", | |
# "python-dotenv", | |
# ] | |
# /// | |
# before version: https://gist.github.com/ftnext/50f990da0dfb94bc27198ec91039ae9d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# requires-python = ">=3.11" | |
# dependencies = [ | |
# "azure-ai-inference", | |
# ] | |
# /// | |
import os | |
from azure.ai.inference import ChatCompletionsClient | |
from azure.ai.inference.models import SystemMessage, UserMessage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# requires-python = ">=3.12" | |
# dependencies = [ | |
# "langchain-azure-ai", | |
# ] | |
# /// | |
import os | |
from langchain_azure_ai.chat_models import AzureAIChatCompletionsModel | |
from langchain_core.messages import HumanMessage, SystemMessage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.adk.agents.remote_a2a_agent import RemoteA2aAgent | |
root_agent = RemoteA2aAgent( | |
name="Parrot_Agent", agent_card="http://0.0.0.0:9999/.well-known/agent.json" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# requires-python = ">=3.12" | |
# dependencies = [ | |
# "fastapi", | |
# "uvicorn", | |
# ] | |
# /// | |
import json | |
from typing import Literal | |
from uuid import uuid4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ghcr.io/astral-sh/uv:python3.12-bookworm AS builder | |
WORKDIR /app | |
ENV UV_COMPILE_BYTECODE=1 | |
ENV UV_LINK_MODE=copy | |
RUN --mount=type=cache,target=/root/.cache/uv \ | |
--mount=type=bind,source=uv.lock,target=uv.lock \ | |
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | |
uv sync --frozen --no-dev | |
FROM python:3.12-slim-bookworm |