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
| # https://github.com/ftnext/fastapi-playground/blob/1908d81cde87f27c495cbcffa4c5142777118f9c/opentelemetry/client.rb | |
| require 'bundler/setup' | |
| Bundler.require | |
| ENV['OTEL_TRACES_EXPORTER'] = 'console' | |
| OpenTelemetry::SDK.configure do |c| | |
| c.use 'OpenTelemetry::Instrumentation::Faraday' | |
| end |
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.13" | |
| # dependencies = [ | |
| # "a2wsgi>=1.10.10", | |
| # "django>=6.0.2", | |
| # "fastapi>=0.133.1", | |
| # "uvicorn>=0.41.0", | |
| # ] | |
| # /// |
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
| # https://deepeval.com/docs/metrics-tool-correctness#usage | |
| from deepeval import evaluate | |
| from deepeval.metrics import ToolCorrectnessMetric | |
| from deepeval.test_case import LLMTestCase, ToolCall | |
| tool_correctness = ToolCorrectnessMetric() | |
| def test_agent_tool_choice(): | |
| test_case = LLMTestCase( |
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
| # https://github.com/ftnext/2026-slides/blob/ef721a71a3dec9a414e5e05de1def3448f0f1272/samplecode/deep-research-otel/gemini.rb | |
| require "faraday" | |
| require "json" | |
| require "opentelemetry/sdk" | |
| require "opentelemetry/instrumentation/faraday" | |
| ENV["OTEL_TRACES_EXPORTER"] = "console" | |
| OpenTelemetry::SDK.configure do |c| | |
| c.use 'OpenTelemetry::Instrumentation::Faraday' | |
| end |
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
| # https://github.com/ftnext/kotoha-python-linter/blob/66566f6e3f3a528e3a4d9c11d59738c6cdb859ee/kotoha/first_linter.py | |
| import argparse | |
| import ast | |
| import importlib | |
| from collections.abc import Iterable | |
| from pathlib import Path | |
| def _load_rule(rule_spec: str) -> type[ast.NodeVisitor]: | |
| """Load a rule class from MODULE:CLASS specification.""" |
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 astroid import nodes | |
| from pylint.checkers import BaseChecker | |
| class ArgumentListTypeHintChecker(BaseChecker): | |
| name = "kotoha-checker" | |
| priority = -1 | |
| msgs = { | |
| "W9999": ( | |
| "Avoid concrete list type in argument '%s'; use Sequence or Iterable instead", |
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
| import logging | |
| import sys | |
| import time | |
| import uuid | |
| from pathlib import Path | |
| from typing import Any, Optional | |
| import uvicorn | |
| from typing_extensions import override |
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
| require "faraday" | |
| require "json" | |
| api_key = ENV["GEMINI_API_KEY"] | |
| conn = Faraday.new( | |
| url: "https://generativelanguage.googleapis.com" | |
| ) | |
| response = conn.post( | |
| "/v1beta/models/gemini-3-flash-preview:generateContent" | |
| ) do |req| |
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 = [ | |
| # "anthropic>=0.79.0", | |
| # ] | |
| # /// | |
| import anthropic | |
| client = anthropic.Anthropic() |
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 = [ | |
| # "anthropic>=0.79.0", | |
| # ] | |
| # /// | |
| from pathlib import Path | |
| import anthropic |
NewerOlder