repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/evaluation/functional/recall.py | mmdet/evaluation/functional/recall.py | # Copyright (c) OpenMMLab. All rights reserved.
from collections.abc import Sequence
import numpy as np
from mmengine.logging import print_log
from terminaltables import AsciiTable
from .bbox_overlaps import bbox_overlaps
def _recalls(all_ious, proposal_nums, thrs):
img_num = all_ious.shape[0]
total_gt_num... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/evaluation/functional/mean_ap.py | mmdet/evaluation/functional/mean_ap.py | # Copyright (c) OpenMMLab. All rights reserved.
from multiprocessing import Pool
import numpy as np
from mmengine.logging import print_log
from mmengine.utils import is_str
from terminaltables import AsciiTable
from .bbox_overlaps import bbox_overlaps
from .class_names import get_classes
def average_precision(recal... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | true |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/evaluation/functional/bbox_overlaps.py | mmdet/evaluation/functional/bbox_overlaps.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
def bbox_overlaps(bboxes1,
bboxes2,
mode='iou',
eps=1e-6,
use_legacy_coordinate=False):
"""Calculate the ious between each bbox of bboxes1 and bboxes2.
Args:
bbox... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/evaluation/functional/__init__.py | mmdet/evaluation/functional/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .bbox_overlaps import bbox_overlaps
from .cityscapes_utils import evaluateImgLists
from .class_names import (cityscapes_classes, coco_classes,
coco_panoptic_classes, dataset_aliases, get_classes,
imagenet_det_classe... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/evaluation/functional/ytvis.py | mmdet/evaluation/functional/ytvis.py | # Copyright (c) Github URL
# Copied from
# https://github.com/youtubevos/cocoapi/blob/master/PythonAPI/pycocotools/ytvos.py
__author__ = 'ychfan'
# Interface for accessing the YouTubeVIS dataset.
# The following API functions are defined:
# YTVIS - YTVIS api class that loads YouTubeVIS annotation file
# and pr... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/demo/mot_demo.py | demo/mot_demo.py | # Copyright (c) OpenMMLab. All rights reserved.
import os
import os.path as osp
import tempfile
from argparse import ArgumentParser
import mmcv
import mmengine
from mmengine.registry import init_default_scope
from mmdet.apis import inference_mot, init_track_model
from mmdet.registry import VISUALIZERS
IMG_EXTENSIONS... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/demo/webcam_demo.py | demo/webcam_demo.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import cv2
import mmcv
import torch
from mmdet.apis import inference_detector, init_detector
from mmdet.registry import VISUALIZERS
def parse_args():
parser = argparse.ArgumentParser(description='MMDetection webcam demo')
parser.add_argument('c... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/demo/demo_multi_model.py | demo/demo_multi_model.py | # Copyright (c) OpenMMLab. All rights reserved.
"""Support for multi-model fusion, and currently only the Weighted Box Fusion
(WBF) fusion method is supported.
References: https://github.com/ZFTurbo/Weighted-Boxes-Fusion
Example:
python demo/demo_multi_model.py demo/demo.jpg \
./configs/faster_rcnn/fas... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/demo/video_demo.py | demo/video_demo.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import cv2
import mmcv
from mmcv.transforms import Compose
from mmengine.utils import track_iter_progress
from mmdet.apis import inference_detector, init_detector
from mmdet.registry import VISUALIZERS
def parse_args():
parser = argparse.ArgumentPa... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/demo/video_gpuaccel_demo.py | demo/video_gpuaccel_demo.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
from typing import Tuple
import cv2
import mmcv
import numpy as np
import torch
import torch.nn as nn
from mmcv.transforms import Compose
from mmengine.utils import track_iter_progress
from mmdet.apis import init_detector
from mmdet.registry import VISUA... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/demo/image_demo.py | demo/image_demo.py | # Copyright (c) OpenMMLab. All rights reserved.
"""Image Demo.
This script adopts a new infenence class, currently supports image path,
np.array and folder input formats, and will support video and webcam
in the future.
Example:
Save visualizations and predictions results::
python demo/image_demo.py demo... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/demo/create_result_gif.py | demo/create_result_gif.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import mmcv
import numpy as np
from mmengine.utils import scandir
try:
import imageio
except ImportError:
imageio = None
# TODO verify after r... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/demo/large_image_demo.py | demo/large_image_demo.py | # Copyright (c) OpenMMLab. All rights reserved.
"""Perform MMDET inference on large images (as satellite imagery) as:
```shell
wget -P checkpoint https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r101_fpn_2x_coco/faster_rcnn_r101_fpn_2x_coco_bbox_mAP-0.398_20200504_210455-1d2dac9c.pth # noqa: E50... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/__init__.py | cookbook/__init__.py | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false | |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/scripts/cookbook_runner.py | cookbook/scripts/cookbook_runner.py | import os
import subprocess
import sys
import click
import inquirer
"""
CLI Tool: Cookbook runner
This tool allows users to interactively navigate through directories, select a target directory,
and execute all `.py` files in the selected directory. It also tracks cookbooks that fail to execute
and prompts the user ... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/scripts/__init__.py | cookbook/scripts/__init__.py | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false | |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/__init__.py | cookbook/11_models/__init__.py | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false | |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/__init__.py | cookbook/11_models/openai/__init__.py | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false | |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/text_to_speech_agent.py | cookbook/11_models/openai/chat/text_to_speech_agent.py | """🔊 Example: Using the OpenAITools Toolkit for Text-to-Speech
This script demonstrates how to use an agent to generate speech from a given text input and optionally save it to a specified audio file.
Run `pip install openai agno` to install the necessary dependencies.
"""
import base64
from pathlib import Path
fr... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/image_agent.py | cookbook/11_models/openai/chat/image_agent.py | from agno.agent import Agent
from agno.media import Image
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[DuckDuckGoTools()],
markdown=True,
)
agent.print_response(
"Tell me about this image and give me th... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/metrics.py | cookbook/11_models/openai/chat/metrics.py | from agno.agent import Agent, RunOutput
from agno.models.openai import OpenAIChat
from agno.tools.yfinance import YFinanceTools
from agno.utils.pprint import pprint_run_response
from rich.pretty import pprint
agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[YFinanceTools()],
markdown=True,
)
run_outpu... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/audio_output_agent.py | cookbook/11_models/openai/chat/audio_output_agent.py | from agno.agent import Agent, RunOutput # noqa
from agno.models.openai import OpenAIChat
from agno.utils.audio import write_audio_to_file
from agno.db.in_memory import InMemoryDb
# Provide the agent with the audio file and audio configuration and get result as text + audio
agent = Agent(
model=OpenAIChat(
... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/image_agent_bytes.py | cookbook/11_models/openai/chat/image_agent_bytes.py | from pathlib import Path
from agno.agent import Agent
from agno.media import Image
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.utils.media import download_image
agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[DuckDuckGoTools()],
markdown=True,... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/tool_use_stream.py | cookbook/11_models/openai/chat/tool_use_stream.py | """Run `pip install ddgs` to install dependencies."""
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[DuckDuckGoTools()],
markdown=True,
)
agent.print_response("Whats happening in ... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/reasoning_o3_mini.py | cookbook/11_models/openai/chat/reasoning_o3_mini.py | from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.yfinance import YFinanceTools
agent = Agent(
model=OpenAIChat(id="o3-mini", reasoning_effort="high"),
tools=[YFinanceTools()],
markdown=True,
)
# Print the response in the terminal
agent.print_response("Write a report o... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/agent_flex_tier.py | cookbook/11_models/openai/chat/agent_flex_tier.py | from agno.agent import Agent
from agno.models.openai import OpenAIChat
agent = Agent(
model=OpenAIChat(id="o4-mini", service_tier="flex"),
markdown=True,
)
agent.print_response("Share a 2 sentence horror story")
| python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/structured_output_stream.py | cookbook/11_models/openai/chat/structured_output_stream.py | from typing import Dict, List
from agno.agent import Agent
from agno.models.openai.chat import OpenAIChat
from pydantic import BaseModel, Field
class MovieScript(BaseModel):
setting: str = Field(
..., description="Provide a nice setting for a blockbuster movie."
)
ending: str = Field(
...... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/pdf_input_local.py | cookbook/11_models/openai/chat/pdf_input_local.py | from pathlib import Path
from agno.agent import Agent
from agno.media import File
from agno.models.openai import OpenAIChat
from agno.utils.media import download_file
pdf_path = Path(__file__).parent.joinpath("ThaiRecipes.pdf")
# Download the file using the download_file function
download_file(
"https://agno-pub... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/memory.py | cookbook/11_models/openai/chat/memory.py | """
This recipe shows how to use personalized memories and summaries in an agent.
Steps:
1. Run: `./cookbook/scripts/run_pgvector.sh` to start a postgres container with pgvector
2. Run: `pip install openai sqlalchemy 'psycopg[binary]' pgvector` to install the dependencies
3. Run: `python cookbook/agents/personalized_me... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/db.py | cookbook/11_models/openai/chat/db.py | """Run `pip install ddgs sqlalchemy openai` to install dependencies."""
from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
# Setup the database
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
db = Pos... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/async_tool_use.py | cookbook/11_models/openai/chat/async_tool_use.py | """Run `pip install ddgs` to install dependencies."""
import asyncio
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[DuckDuckGoTools()],
markdown=True,
)
asyncio.run(agent.aprint_... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/with_retries.py | cookbook/11_models/openai/chat/with_retries.py | from agno.agent import Agent
from agno.models.openai import OpenAIChat
agent = Agent(
model=OpenAIChat(
id="gpt-wrong-id", # Deliberately wrong model ID to trigger retries
retries=3,
delay_between_retries=1,
exponential_backoff=True,
),
)
agent.print_response("What is the capit... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/basic_stream.py | cookbook/11_models/openai/chat/basic_stream.py | from typing import Iterator # noqa
from agno.agent import Agent, RunOutputEvent # noqa
from agno.models.openai import OpenAIChat
agent = Agent(model=OpenAIChat(id="gpt-4o"), markdown=True)
# Get the response in a variable
# run_response: Iterator[RunOutputEvent] = agent.run("Share a 2 sentence horror story", stream... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/knowledge.py | cookbook/11_models/openai/chat/knowledge.py | """Run `pip install ddgs sqlalchemy pgvector pypdf openai` to install dependencies."""
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.models.openai import OpenAIChat
from agno.vectordb.pgvector import PgVector
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
knowledge = ... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/audio_input_agent.py | cookbook/11_models/openai/chat/audio_input_agent.py | import requests
from agno.agent import Agent, RunOutput # noqa
from agno.media import Audio
from agno.models.openai import OpenAIChat
# Fetch the audio file and convert it to a base64 encoded string
url = "https://openaiassets.blob.core.windows.net/$web/API/docs/audio/alloy.wav"
response = requests.get(url)
response.... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/verbosity_control.py | cookbook/11_models/openai/chat/verbosity_control.py | from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.yfinance import YFinanceTools
agent = Agent(
model=OpenAIChat(id="gpt-5", verbosity="high"),
tools=[YFinanceTools()],
instructions="Use tables to display data.",
markdown=True,
)
agent.print_response("Write a report ... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/image_agent_with_memory.py | cookbook/11_models/openai/chat/image_agent_with_memory.py | from agno.agent import Agent
from agno.media import Image
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[DuckDuckGoTools()],
markdown=True,
add_history_to_context=True,
num_history_runs=3,
)
agent.pri... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/pdf_input_file_upload.py | cookbook/11_models/openai/chat/pdf_input_file_upload.py | """
In this example, we upload a PDF file to Google GenAI directly and then use it as an input to an agent.
"""
from pathlib import Path
from agno.agent import Agent
from agno.media import File
from agno.models.openai import OpenAIChat
pdf_path = Path(__file__).parent.joinpath("ThaiRecipes.pdf")
# Pass the local PD... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/audio_input_local_file_upload.py | cookbook/11_models/openai/chat/audio_input_local_file_upload.py | from pathlib import Path
from agno.agent import Agent
from agno.media import Audio
from agno.models.openai import OpenAIChat
# Provide the agent with the audio file and get result as text
agent = Agent(
model=OpenAIChat(id="gpt-4o-audio-preview", modalities=["text"]),
markdown=True,
)
# Please download a sam... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/tool_use.py | cookbook/11_models/openai/chat/tool_use.py | """Run `pip install ddgs` to install dependencies."""
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[DuckDuckGoTools()],
markdown=True,
)
agent.print_response("Whats happening in ... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/basic.py | cookbook/11_models/openai/chat/basic.py | from agno.agent import Agent, RunOutput # noqa
from agno.models.openai import OpenAIChat
agent = Agent(model=OpenAIChat(id="gpt-4o", temperature=0.5), markdown=True)
# Get the response in a variable
# run: RunOutput = agent.run("Share a 2 sentence horror story")
# print(run.content)
# Print the response in the term... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/pdf_input_url.py | cookbook/11_models/openai/chat/pdf_input_url.py | from agno.agent import Agent
from agno.media import File
from agno.models.openai import OpenAIChat
agent = Agent(
model=OpenAIChat(id="gpt-4o"),
markdown=True,
add_history_to_context=True,
)
agent.print_response(
"Suggest me a recipe from the attached file.",
files=[File(url="https://agno-public.s... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/audio_input_and_output_multi_turn.py | cookbook/11_models/openai/chat/audio_input_and_output_multi_turn.py | from pathlib import Path
import requests
from agno.agent import Agent, RunOutput # noqa
from agno.media import Audio
from agno.models.openai import OpenAIChat
from agno.utils.audio import write_audio_to_file
# Fetch the audio file and convert it to a base64 encoded string
url = "https://openaiassets.blob.core.window... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/async_basic_stream.py | cookbook/11_models/openai/chat/async_basic_stream.py | import asyncio
from typing import Iterator # noqa
from agno.agent import Agent, RunOutputEvent # noqa
from agno.models.openai import OpenAIChat
agent = Agent(model=OpenAIChat(id="gpt-4o"), markdown=True)
# Get the response in a variable
# run_response: Iterator[RunOutputEvent] = agent.run(
# "Share a 2 sentenc... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/async_structured_response_stream.py | cookbook/11_models/openai/chat/async_structured_response_stream.py | import asyncio
from typing import Dict, List
from agno.agent import Agent
from agno.models.openai.chat import OpenAIChat
from pydantic import BaseModel, Field
class MovieScript(BaseModel):
setting: str = Field(
..., description="Provide a nice setting for a blockbuster movie."
)
ending: str = Fie... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/retry.py | cookbook/11_models/openai/chat/retry.py | """Example demonstrating how to set up retries with OpenAI Chat."""
from agno.agent import Agent
from agno.models.openai import OpenAIChat
# We will use a deliberately wrong model ID, to trigger retries.
wrong_model_id = "gpt-wrong-id"
agent = Agent(
model=OpenAIChat(
id=wrong_model_id,
retries=3... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/__init__.py | cookbook/11_models/openai/chat/__init__.py | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false | |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/generate_images.py | cookbook/11_models/openai/chat/generate_images.py | from agno.agent import Agent, RunOutput
from agno.models.openai import OpenAIChat
from agno.tools.dalle import DalleTools
image_agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[DalleTools()],
description="You are an AI agent that can generate images using DALL-E.",
instructions="When the user asks ... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/audio_output_stream.py | cookbook/11_models/openai/chat/audio_output_stream.py | import base64
import wave
from typing import Iterator
from agno.agent import Agent, RunOutputEvent # noqa
from agno.db.in_memory import InMemoryDb
from agno.models.openai import OpenAIChat
# Audio Configuration
SAMPLE_RATE = 24000 # Hz (24kHz)
CHANNELS = 1 # Mono (Change to 2 if Stereo)
SAMPLE_WIDTH = 2 # Bytes (... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/custom_role_map.py | cookbook/11_models/openai/chat/custom_role_map.py | """This example shows how to use a custom role map with the OpenAIChat class.
This is useful when using a custom model that doesn't support the default role map.
To run this example:
- Set the MISTRAL_API_KEY environment variable.
- Run `pip install openai agno` to install dependencies.
"""
from os import getenv
fr... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/structured_output.py | cookbook/11_models/openai/chat/structured_output.py | from typing import Dict, List
from agno.agent import Agent, RunOutput # noqa
from agno.models.openai import OpenAIChat
from pydantic import BaseModel, Field
from rich.pretty import pprint # noqa
class MovieScript(BaseModel):
setting: str = Field(
..., description="Provide a nice setting for a blockbust... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/basic_stream_metrics.py | cookbook/11_models/openai/chat/basic_stream_metrics.py | from typing import Iterator # noqa
from agno.agent import Agent, RunOutputEvent # noqa
from agno.models.openai import OpenAIChat
from agno.db.in_memory import InMemoryDb
agent = Agent(model=OpenAIChat(id="gpt-4o"), db=InMemoryDb(), markdown=True)
# Get the response in a variable
# run_response: Iterator[RunOutputEv... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/chat/async_basic.py | cookbook/11_models/openai/chat/async_basic.py | import asyncio
from agno.agent import Agent, RunOutput # noqa
from agno.models.openai import OpenAIChat
agent = Agent(model=OpenAIChat(id="gpt-4o"), markdown=True)
# Get the response in a variable
# run: RunOutput = agent.run("Share a 2 sentence horror story")
# print(run.content)
# Print the response in the termi... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/image_agent.py | cookbook/11_models/openai/responses/image_agent.py | from agno.agent import Agent
from agno.media import Image
from agno.models.openai import OpenAIResponses
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=OpenAIResponses(id="gpt-4o"),
tools=[DuckDuckGoTools()],
markdown=True,
)
agent.print_response(
"Tell me about this image and ... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/websearch_builtin_tool.py | cookbook/11_models/openai/responses/websearch_builtin_tool.py | from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.file import FileTools
agent = Agent(
model=OpenAIResponses(id="gpt-4o"),
tools=[{"type": "web_search_preview"}, FileTools()],
instructions="Save the results to a file with a relevant name.",
markdown=True,
)
age... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/tool_use_gpt_5.py | cookbook/11_models/openai/responses/tool_use_gpt_5.py | from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.yfinance import YFinanceTools
agent = Agent(
model=OpenAIResponses(id="gpt-5"),
tools=[YFinanceTools(cache_results=True)],
markdown=True,
telemetry=False,
)
agent.print_response("What is the current price of TS... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/image_agent_bytes.py | cookbook/11_models/openai/responses/image_agent_bytes.py | from pathlib import Path
from agno.agent import Agent
from agno.media import Image
from agno.models.openai import OpenAIResponses
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.utils.media import download_image
agent = Agent(
model=OpenAIResponses(id="gpt-4o"),
tools=[DuckDuckGoTools()],
mark... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/tool_use_stream.py | cookbook/11_models/openai/responses/tool_use_stream.py | """Run `pip install ddgs` to install dependencies."""
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=OpenAIResponses(id="gpt-4o"),
tools=[DuckDuckGoTools()],
markdown=True,
)
agent.print_response("Whats hap... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/reasoning_o3_mini.py | cookbook/11_models/openai/responses/reasoning_o3_mini.py | from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.yfinance import YFinanceTools
agent = Agent(
model=OpenAIResponses(id="o3-mini"),
tools=[YFinanceTools()],
markdown=True,
)
# Print the response in the terminal
agent.print_response("Write a report on the NVDA, is ... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/tool_use_o3.py | cookbook/11_models/openai/responses/tool_use_o3.py | from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.yfinance import YFinanceTools
agent = Agent(
model=OpenAIResponses(id="o3"),
tools=[YFinanceTools(cache_results=True)],
markdown=True,
telemetry=False,
)
agent.print_response("What is the current price of TSLA?... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/structured_output_with_tools.py | cookbook/11_models/openai/responses/structured_output_with_tools.py | from typing import List
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.duckduckgo import DuckDuckGoTools
from pydantic import BaseModel, Field
class MovieScript(BaseModel):
setting: str = Field(
..., description="Provide a nice setting for a blockbuster movie.... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/agent_flex_tier.py | cookbook/11_models/openai/responses/agent_flex_tier.py | from agno.agent import Agent
from agno.models.openai import OpenAIResponses
agent = Agent(
model=OpenAIResponses(id="o4-mini", service_tier="flex"),
markdown=True,
)
agent.print_response("Share a 2 sentence horror story")
| python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/pdf_input_local.py | cookbook/11_models/openai/responses/pdf_input_local.py | from pathlib import Path
from agno.agent import Agent
from agno.media import File
from agno.models.openai.responses import OpenAIResponses
from agno.utils.media import download_file
pdf_path = Path(__file__).parent.joinpath("ThaiRecipes.pdf")
# Download the file using the download_file function
download_file(
"h... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/memory.py | cookbook/11_models/openai/responses/memory.py | """
This recipe shows how to use personalized memories and summaries in an agent.
Steps:
1. Run: `./cookbook/scripts/run_pgvector.sh` to start a postgres container with pgvector
2. Run: `pip install openai sqlalchemy 'psycopg[binary]' pgvector` to install the dependencies
3. Run: `python cookbook/agents/personalized_me... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/db.py | cookbook/11_models/openai/responses/db.py | """Run `pip install ddgs sqlalchemy openai` to install dependencies."""
from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.models.openai import OpenAIResponses
from agno.tools.duckduckgo import DuckDuckGoTools
# Setup the database
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
db ... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/async_tool_use.py | cookbook/11_models/openai/responses/async_tool_use.py | """Run `pip install ddgs` to install dependencies."""
import asyncio
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=OpenAIResponses(id="gpt-4o"),
tools=[DuckDuckGoTools()],
markdown=True,
)
asyncio.run(age... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/basic_stream.py | cookbook/11_models/openai/responses/basic_stream.py | from typing import Iterator # noqa
from agno.agent import Agent, RunOutputEvent # noqa
from agno.models.openai import OpenAIResponses
agent = Agent(model=OpenAIResponses(id="gpt-4o"), markdown=True)
# Get the response in a variable
# run_response: Iterator[RunOutputEvent] = agent.run("Share a 2 sentence horror stor... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/knowledge.py | cookbook/11_models/openai/responses/knowledge.py | """Run `pip install ddgs sqlalchemy pgvector pypdf openai` to install dependencies."""
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.models.openai import OpenAIResponses
from agno.vectordb.pgvector import PgVector
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
knowled... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/zdr_reasoning_agent.py | cookbook/11_models/openai/responses/zdr_reasoning_agent.py | """
An example of using OpenAI Responses with reasoning features and ZDR mode enabled.
Read more about ZDR mode here: https://openai.com/enterprise-privacy/.
"""
from agno.agent import Agent
from agno.db.in_memory import InMemoryDb
from agno.models.openai import OpenAIResponses
agent = Agent(
name="ZDR Compliant... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/verbosity_control.py | cookbook/11_models/openai/responses/verbosity_control.py | from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.yfinance import YFinanceTools
agent = Agent(
model=OpenAIChat(id="gpt-5", verbosity="high"),
tools=[YFinanceTools()],
instructions="Use tables to display data.",
markdown=True,
)
agent.print_response("Write a report ... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/image_agent_with_memory.py | cookbook/11_models/openai/responses/image_agent_with_memory.py | from agno.agent import Agent
from agno.media import Image
from agno.models.openai import OpenAIResponses
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=OpenAIResponses(id="gpt-4o"),
tools=[DuckDuckGoTools()],
markdown=True,
add_history_to_context=True,
num_history_runs=3,
)
... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/tool_use.py | cookbook/11_models/openai/responses/tool_use.py | """Run `pip install ddgs` to install dependencies."""
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=OpenAIResponses(id="gpt-4o"),
tools=[DuckDuckGoTools()],
markdown=True,
)
agent.print_response("Whats hap... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/basic.py | cookbook/11_models/openai/responses/basic.py | from agno.agent import Agent, RunOutput # noqa
from agno.models.openai import OpenAIResponses
agent = Agent(model=OpenAIResponses(id="gpt-4o"), markdown=True)
# Get the response in a variable
# run: RunOutput = agent.run("Share a 2 sentence horror story")
# print(run.content)
# Print the response in the terminal
ag... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/image_generation_agent.py | cookbook/11_models/openai/responses/image_generation_agent.py | """🔧 Example: Using the OpenAITools Toolkit for Image Generation
This script demonstrates how to use the `OpenAITools` toolkit, which includes a tool for generating images using OpenAI's DALL-E within an Agno Agent.
Example prompts to try:
- "Create a surreal painting of a floating city in the clouds at sunset"
- "G... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/pdf_input_url.py | cookbook/11_models/openai/responses/pdf_input_url.py | from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.media import File
from agno.models.openai.responses import OpenAIResponses
# Setup the database for the Agent Session to be stored
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
db = PostgresDb(db_url=db_url)
agent = Agent(
mo... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/async_basic_stream.py | cookbook/11_models/openai/responses/async_basic_stream.py | import asyncio
from typing import Iterator # noqa
from agno.agent import Agent, RunOutputEvent # noqa
from agno.models.openai import OpenAIResponses
agent = Agent(model=OpenAIResponses(id="gpt-4o"), markdown=True)
# Get the response in a variable
# run_response: Iterator[RunOutputEvent] = agent.run("Share a 2 sent... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/__init__.py | cookbook/11_models/openai/responses/__init__.py | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false | |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/structured_output.py | cookbook/11_models/openai/responses/structured_output.py | from typing import List
from agno.agent import Agent, RunOutput # noqa
from agno.models.openai import OpenAIResponses
from pydantic import BaseModel, Field
from rich.pretty import pprint # noqa
class MovieScript(BaseModel):
setting: str = Field(
..., description="Provide a nice setting for a blockbuste... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/deep_research_agent.py | cookbook/11_models/openai/responses/deep_research_agent.py | from textwrap import dedent
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
agent = Agent(
model=OpenAIResponses(id="o4-mini-deep-research", max_tool_calls=1),
instructions=dedent("""
You are an expert research analyst with access to advanced research tools.
When y... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/openai/responses/async_basic.py | cookbook/11_models/openai/responses/async_basic.py | import asyncio
from agno.agent import Agent, RunOutput # noqa
from agno.models.openai import OpenAIResponses
agent = Agent(model=OpenAIResponses(id="gpt-4o"), markdown=True)
# Get the response in a variable
# run: RunOutput = agent.run("Share a 2 sentence horror story")
# print(run.content)
# Print the response in... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/nvidia/tool_use_stream.py | cookbook/11_models/nvidia/tool_use_stream.py | """Run `pip install ddgs` to install dependencies."""
from agno.agent import Agent
from agno.models.nvidia import Nvidia
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=Nvidia(id="meta/llama-3.3-70b-instruct"),
tools=[DuckDuckGoTools()],
markdown=True,
)
agent.print_response("Whats... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/nvidia/async_tool_use.py | cookbook/11_models/nvidia/async_tool_use.py | """
Async example using Nvidia with tool calls.
"""
import asyncio
from agno.agent import Agent
from agno.models.nvidia import Nvidia
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=Nvidia(id="meta/llama-3.3-70b-instruct"),
tools=[DuckDuckGoTools()],
markdown=True,
)
asyncio.run(a... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/nvidia/basic_stream.py | cookbook/11_models/nvidia/basic_stream.py | from agno.agent import Agent, RunOutputEvent # noqa
from agno.models.nvidia import Nvidia
agent = Agent(model=Nvidia(id="meta/llama-3.3-70b-instruct"), markdown=True)
# Get the response in a variable
# run_response: Iterator[RunOutputEvent] = agent.run("Share a 2 sentence horror story", stream=True)
# for chunk in r... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/nvidia/tool_use.py | cookbook/11_models/nvidia/tool_use.py | """Run `pip install ddgs` to install dependencies."""
from agno.agent import Agent
from agno.models.nvidia import Nvidia
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=Nvidia(id="meta/llama-3.3-70b-instruct"),
tools=[DuckDuckGoTools()],
markdown=True,
)
agent.print_response("Whats... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/nvidia/basic.py | cookbook/11_models/nvidia/basic.py | from agno.agent import Agent, RunOutput # noqa
from agno.models.nvidia import Nvidia
agent = Agent(model=Nvidia(id="meta/llama-3.3-70b-instruct"), markdown=True)
# Get the response in a variable
# run: RunOutput = agent.run("Share a 2 sentence horror story")
# print(run.content)
# Print the response in the terminal... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/nvidia/async_basic_stream.py | cookbook/11_models/nvidia/async_basic_stream.py | """
Basic streaming async example using Nvidia.
"""
import asyncio
from agno.agent import Agent
from agno.models.nvidia import Nvidia
agent = Agent(model=Nvidia(id="meta/llama-3.3-70b-instruct"), markdown=True)
asyncio.run(agent.aprint_response("Share a 2 sentence horror story", stream=True))
| python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/nvidia/retry.py | cookbook/11_models/nvidia/retry.py | """Example demonstrating how to set up retries with NVIDIA."""
from agno.agent import Agent
from agno.models.nvidia import Nvidia
# We will use a deliberately wrong model ID, to trigger retries.
wrong_model_id = "nvidia-wrong-id"
agent = Agent(
model=Nvidia(
id=wrong_model_id,
retries=3, # Numbe... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/nvidia/__init__.py | cookbook/11_models/nvidia/__init__.py | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false | |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/nvidia/async_basic.py | cookbook/11_models/nvidia/async_basic.py | """
Basic async example using Nvidia.
"""
import asyncio
from agno.agent import Agent
from agno.models.nvidia import Nvidia
agent = Agent(model=Nvidia(id="meta/llama-3.3-70b-instruct"), markdown=True)
asyncio.run(agent.aprint_response("Share a 2 sentence horror story"))
| python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/cohere/image_agent.py | cookbook/11_models/cohere/image_agent.py | from agno.agent import Agent
from agno.media import Image
from agno.models.cohere import Cohere
agent = Agent(
model=Cohere(id="c4ai-aya-vision-8b"),
markdown=True,
)
agent.print_response(
"Tell me about this image.",
images=[
Image(
url="https://upload.wikimedia.org/wikipedia/comm... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/cohere/image_agent_bytes.py | cookbook/11_models/cohere/image_agent_bytes.py | from pathlib import Path
from agno.agent import Agent
from agno.media import Image
from agno.models.cohere.chat import Cohere
from agno.utils.media import download_image
agent = Agent(
model=Cohere(id="c4ai-aya-vision-8b"),
markdown=True,
)
image_path = Path(__file__).parent.joinpath("sample.jpg")
download_... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/cohere/tool_use_stream.py | cookbook/11_models/cohere/tool_use_stream.py | """Run `pip install ddgs` to install dependencies."""
from agno.agent import Agent
from agno.models.cohere import Cohere
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=Cohere(id="command-a-03-2025"),
tools=[DuckDuckGoTools()],
markdown=True,
)
agent.print_response("Whats happening... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/cohere/memory.py | cookbook/11_models/cohere/memory.py | """
This recipe shows how to use personalized memories and summaries in an agent.
Steps:
1. Run: `./cookbook/scripts/run_pgvector.sh` to start a postgres container with pgvector
2. Run: `pip install cohere sqlalchemy 'psycopg[binary]' pgvector` to install the dependencies
3. Run: `python cookbook/models/cohere/memory.p... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/cohere/db.py | cookbook/11_models/cohere/db.py | """Run `pip install ddgs sqlalchemy cohere` to install dependencies."""
from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.models.cohere import Cohere
from agno.tools.duckduckgo import DuckDuckGoTools
# Setup the database
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
db = Postgre... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/cohere/async_tool_use.py | cookbook/11_models/cohere/async_tool_use.py | """
Async example using Cohere with tool calls.
"""
import asyncio
from agno.agent import Agent
from agno.models.cohere import Cohere
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=Cohere(id="command-a-03-2025"),
tools=[DuckDuckGoTools()],
markdown=True,
)
asyncio.run(agent.aprin... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/cohere/basic_stream.py | cookbook/11_models/cohere/basic_stream.py | from agno.agent import Agent, RunOutputEvent # noqa
from agno.models.cohere import Cohere
agent = Agent(model=Cohere(id="command-a-03-2025"), markdown=True)
# Get the response in a variable
# run_response: Iterator[RunOutputEvent] = agent.run("Share a 2 sentence horror story", stream=True)
# for chunk in run_respons... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/cohere/knowledge.py | cookbook/11_models/cohere/knowledge.py | """Run `pip install ddgs sqlalchemy pgvector pypdf openai cohere` to install dependencies."""
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.models.cohere import Cohere
from agno.vectordb.pgvector import PgVector
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
knowledge... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/cohere/tool_use.py | cookbook/11_models/cohere/tool_use.py | """Run `pip install ddgs` to install dependencies."""
from agno.agent import Agent
from agno.models.cohere import Cohere
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=Cohere(id="command-a-03-2025"),
tools=[DuckDuckGoTools()],
markdown=True,
)
agent.print_response("Whats happening... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/cohere/basic.py | cookbook/11_models/cohere/basic.py | from agno.agent import Agent, RunOutput # noqa
from agno.models.cohere import Cohere
agent = Agent(model=Cohere(id="command-a-03-2025"), markdown=True)
# Get the response in a variable
# run: RunOutput = agent.run("Share a 2 sentence horror story")
# print(run.content)
# Print the response in the terminal
agent.pri... | python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
agno-agi/agno | https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/11_models/cohere/async_basic_stream.py | cookbook/11_models/cohere/async_basic_stream.py | """
Basic streaming async example using Cohere.
"""
import asyncio
from agno.agent import Agent
from agno.models.cohere import Cohere
agent = Agent(
model=Cohere(id="command-a-03-2025"),
markdown=True,
)
asyncio.run(agent.aprint_response("Share a 2 sentence horror story", stream=True))
| python | Apache-2.0 | 26b9daa0fb760c3ad8384e1ba9218b1bce854535 | 2026-01-04T14:41:49.609528Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.