@hera-al/server 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +325 -0
- package/bundled/apple-notes/SKILL.md +77 -0
- package/bundled/apple-reminders/SKILL.md +96 -0
- package/bundled/blogwatcher/SKILL.md +69 -0
- package/bundled/camsnap/SKILL.md +45 -0
- package/bundled/discord/SKILL.md +578 -0
- package/bundled/gemini/SKILL.md +43 -0
- package/bundled/gifgrep/SKILL.md +79 -0
- package/bundled/github/SKILL.md +77 -0
- package/bundled/gog/SKILL.md +116 -0
- package/bundled/goplaces/SKILL.md +52 -0
- package/bundled/himalaya/SKILL.md +257 -0
- package/bundled/himalaya/references/configuration.md +184 -0
- package/bundled/himalaya/references/message-composition.md +199 -0
- package/bundled/homebrew/SKILL.md +82 -0
- package/bundled/local-places/SERVER_README.md +101 -0
- package/bundled/local-places/SKILL.md +102 -0
- package/bundled/local-places/pyproject.toml +21 -0
- package/bundled/local-places/src/local_places/__init__.py +2 -0
- package/bundled/local-places/src/local_places/google_places.py +314 -0
- package/bundled/local-places/src/local_places/main.py +65 -0
- package/bundled/local-places/src/local_places/schemas.py +107 -0
- package/bundled/markitdown/SKILL.md +96 -0
- package/bundled/mcporter/SKILL.md +61 -0
- package/bundled/merge-pr/SKILL.md +187 -0
- package/bundled/merge-pr/agents/openai.yaml +4 -0
- package/bundled/nano-banana-pro/SKILL.md +58 -0
- package/bundled/nano-banana-pro/scripts/generate_image.py +184 -0
- package/bundled/nano-pdf/SKILL.md +38 -0
- package/bundled/open-prose/README.md +25 -0
- package/bundled/open-prose/index.ts +5 -0
- package/bundled/open-prose/openclaw.plugin.json +11 -0
- package/bundled/open-prose/package.json +15 -0
- package/bundled/open-prose/skills/prose/LICENSE +21 -0
- package/bundled/open-prose/skills/prose/SKILL.md +323 -0
- package/bundled/open-prose/skills/prose/alt-borges.md +141 -0
- package/bundled/open-prose/skills/prose/alts/arabian-nights.md +358 -0
- package/bundled/open-prose/skills/prose/alts/borges.md +360 -0
- package/bundled/open-prose/skills/prose/alts/folk.md +322 -0
- package/bundled/open-prose/skills/prose/alts/homer.md +346 -0
- package/bundled/open-prose/skills/prose/alts/kafka.md +373 -0
- package/bundled/open-prose/skills/prose/compiler.md +2971 -0
- package/bundled/open-prose/skills/prose/examples/01-hello-world.prose +4 -0
- package/bundled/open-prose/skills/prose/examples/02-research-and-summarize.prose +6 -0
- package/bundled/open-prose/skills/prose/examples/03-code-review.prose +17 -0
- package/bundled/open-prose/skills/prose/examples/04-write-and-refine.prose +14 -0
- package/bundled/open-prose/skills/prose/examples/05-debug-issue.prose +20 -0
- package/bundled/open-prose/skills/prose/examples/06-explain-codebase.prose +17 -0
- package/bundled/open-prose/skills/prose/examples/07-refactor.prose +20 -0
- package/bundled/open-prose/skills/prose/examples/08-blog-post.prose +20 -0
- package/bundled/open-prose/skills/prose/examples/09-research-with-agents.prose +25 -0
- package/bundled/open-prose/skills/prose/examples/10-code-review-agents.prose +32 -0
- package/bundled/open-prose/skills/prose/examples/11-skills-and-imports.prose +27 -0
- package/bundled/open-prose/skills/prose/examples/12-secure-agent-permissions.prose +43 -0
- package/bundled/open-prose/skills/prose/examples/13-variables-and-context.prose +51 -0
- package/bundled/open-prose/skills/prose/examples/14-composition-blocks.prose +48 -0
- package/bundled/open-prose/skills/prose/examples/15-inline-sequences.prose +23 -0
- package/bundled/open-prose/skills/prose/examples/16-parallel-reviews.prose +19 -0
- package/bundled/open-prose/skills/prose/examples/17-parallel-research.prose +19 -0
- package/bundled/open-prose/skills/prose/examples/18-mixed-parallel-sequential.prose +36 -0
- package/bundled/open-prose/skills/prose/examples/19-advanced-parallel.prose +71 -0
- package/bundled/open-prose/skills/prose/examples/20-fixed-loops.prose +20 -0
- package/bundled/open-prose/skills/prose/examples/21-pipeline-operations.prose +35 -0
- package/bundled/open-prose/skills/prose/examples/22-error-handling.prose +51 -0
- package/bundled/open-prose/skills/prose/examples/23-retry-with-backoff.prose +63 -0
- package/bundled/open-prose/skills/prose/examples/24-choice-blocks.prose +86 -0
- package/bundled/open-prose/skills/prose/examples/25-conditionals.prose +114 -0
- package/bundled/open-prose/skills/prose/examples/26-parameterized-blocks.prose +100 -0
- package/bundled/open-prose/skills/prose/examples/27-string-interpolation.prose +105 -0
- package/bundled/open-prose/skills/prose/examples/28-automated-pr-review.prose +37 -0
- package/bundled/open-prose/skills/prose/examples/28-gas-town.prose +1572 -0
- package/bundled/open-prose/skills/prose/examples/29-captains-chair.prose +218 -0
- package/bundled/open-prose/skills/prose/examples/30-captains-chair-simple.prose +42 -0
- package/bundled/open-prose/skills/prose/examples/31-captains-chair-with-memory.prose +145 -0
- package/bundled/open-prose/skills/prose/examples/33-pr-review-autofix.prose +168 -0
- package/bundled/open-prose/skills/prose/examples/34-content-pipeline.prose +204 -0
- package/bundled/open-prose/skills/prose/examples/35-feature-factory.prose +296 -0
- package/bundled/open-prose/skills/prose/examples/36-bug-hunter.prose +237 -0
- package/bundled/open-prose/skills/prose/examples/37-the-forge.prose +1474 -0
- package/bundled/open-prose/skills/prose/examples/38-skill-scan.prose +455 -0
- package/bundled/open-prose/skills/prose/examples/39-architect-by-simulation.prose +277 -0
- package/bundled/open-prose/skills/prose/examples/40-rlm-self-refine.prose +32 -0
- package/bundled/open-prose/skills/prose/examples/41-rlm-divide-conquer.prose +38 -0
- package/bundled/open-prose/skills/prose/examples/42-rlm-filter-recurse.prose +46 -0
- package/bundled/open-prose/skills/prose/examples/43-rlm-pairwise.prose +50 -0
- package/bundled/open-prose/skills/prose/examples/44-run-endpoint-ux-test.prose +261 -0
- package/bundled/open-prose/skills/prose/examples/45-plugin-release.prose +159 -0
- package/bundled/open-prose/skills/prose/examples/45-run-endpoint-ux-test-with-remediation.prose +637 -0
- package/bundled/open-prose/skills/prose/examples/46-run-endpoint-ux-test-fast.prose +148 -0
- package/bundled/open-prose/skills/prose/examples/46-workflow-crystallizer.prose +225 -0
- package/bundled/open-prose/skills/prose/examples/47-language-self-improvement.prose +356 -0
- package/bundled/open-prose/skills/prose/examples/48-habit-miner.prose +445 -0
- package/bundled/open-prose/skills/prose/examples/49-prose-run-retrospective.prose +210 -0
- package/bundled/open-prose/skills/prose/examples/README.md +391 -0
- package/bundled/open-prose/skills/prose/examples/roadmap/README.md +22 -0
- package/bundled/open-prose/skills/prose/examples/roadmap/iterative-refinement.prose +20 -0
- package/bundled/open-prose/skills/prose/examples/roadmap/parallel-review.prose +18 -0
- package/bundled/open-prose/skills/prose/examples/roadmap/simple-pipeline.prose +17 -0
- package/bundled/open-prose/skills/prose/examples/roadmap/syntax/open-prose-syntax.prose +223 -0
- package/bundled/open-prose/skills/prose/guidance/antipatterns.md +951 -0
- package/bundled/open-prose/skills/prose/guidance/patterns.md +700 -0
- package/bundled/open-prose/skills/prose/guidance/system-prompt.md +180 -0
- package/bundled/open-prose/skills/prose/help.md +144 -0
- package/bundled/open-prose/skills/prose/lib/README.md +108 -0
- package/bundled/open-prose/skills/prose/lib/calibrator.prose +215 -0
- package/bundled/open-prose/skills/prose/lib/cost-analyzer.prose +174 -0
- package/bundled/open-prose/skills/prose/lib/error-forensics.prose +250 -0
- package/bundled/open-prose/skills/prose/lib/inspector.prose +196 -0
- package/bundled/open-prose/skills/prose/lib/profiler.prose +460 -0
- package/bundled/open-prose/skills/prose/lib/program-improver.prose +275 -0
- package/bundled/open-prose/skills/prose/lib/project-memory.prose +118 -0
- package/bundled/open-prose/skills/prose/lib/user-memory.prose +93 -0
- package/bundled/open-prose/skills/prose/lib/vm-improver.prose +243 -0
- package/bundled/open-prose/skills/prose/primitives/session.md +593 -0
- package/bundled/open-prose/skills/prose/prose.md +1237 -0
- package/bundled/open-prose/skills/prose/state/filesystem.md +498 -0
- package/bundled/open-prose/skills/prose/state/in-context.md +384 -0
- package/bundled/open-prose/skills/prose/state/postgres.md +880 -0
- package/bundled/open-prose/skills/prose/state/sqlite.md +574 -0
- package/bundled/peekaboo/SKILL.md +190 -0
- package/bundled/prepare-pr/SKILL.md +277 -0
- package/bundled/prepare-pr/agents/openai.yaml +4 -0
- package/bundled/review-pr/SKILL.md +228 -0
- package/bundled/review-pr/agents/openai.yaml +4 -0
- package/bundled/sag/SKILL.md +87 -0
- package/bundled/skill-creator/SKILL.md +370 -0
- package/bundled/skill-creator/license.txt +202 -0
- package/bundled/skill-creator/scripts/init_skill.py +378 -0
- package/bundled/skill-creator/scripts/package_skill.py +111 -0
- package/bundled/skill-creator/scripts/quick_validate.py +101 -0
- package/bundled/spotify-player/SKILL.md +64 -0
- package/bundled/ssh/SKILL.md +119 -0
- package/bundled/summarize/SKILL.md +87 -0
- package/bundled/video-frames/SKILL.md +46 -0
- package/bundled/video-frames/scripts/frame.sh +81 -0
- package/bundled/voice-call/SKILL.md +45 -0
- package/bundled/wacli/SKILL.md +72 -0
- package/bundled/weather/SKILL.md +54 -0
- package/dist/agent/agent-service.d.ts +88 -0
- package/dist/agent/agent-service.js +1 -0
- package/dist/agent/message-queue.d.ts +24 -0
- package/dist/agent/message-queue.js +1 -0
- package/dist/agent/prompt-builder.d.ts +58 -0
- package/dist/agent/prompt-builder.js +1 -0
- package/dist/agent/session-agent.d.ts +197 -0
- package/dist/agent/session-agent.js +1 -0
- package/dist/agent/session-db.d.ts +26 -0
- package/dist/agent/session-db.js +1 -0
- package/dist/agent/session-error-handler.d.ts +37 -0
- package/dist/agent/session-error-handler.js +1 -0
- package/dist/agent/session-manager.d.ts +19 -0
- package/dist/agent/session-manager.js +1 -0
- package/dist/agent/workspace-files.d.ts +51 -0
- package/dist/agent/workspace-files.js +1 -0
- package/dist/auth/auth-middleware.d.ts +9 -0
- package/dist/auth/auth-middleware.js +1 -0
- package/dist/auth/node-signature-db.d.ts +30 -0
- package/dist/auth/node-signature-db.js +1 -0
- package/dist/auth/token-db.d.ts +38 -0
- package/dist/auth/token-db.js +1 -0
- package/dist/browser/browser-service.d.ts +9 -0
- package/dist/browser/browser-service.js +1 -0
- package/dist/channels/channel.d.ts +2 -0
- package/dist/channels/channel.js +1 -0
- package/dist/channels/responses.d.ts +21 -0
- package/dist/channels/responses.js +1 -0
- package/dist/commands/clear.d.ts +7 -0
- package/dist/commands/clear.js +1 -0
- package/dist/commands/cmd.d.ts +7 -0
- package/dist/commands/cmd.js +1 -0
- package/dist/commands/coder.d.ts +12 -0
- package/dist/commands/coder.js +1 -0
- package/dist/commands/command-registry.d.ts +12 -0
- package/dist/commands/command-registry.js +1 -0
- package/dist/commands/command.d.ts +22 -0
- package/dist/commands/command.js +1 -0
- package/dist/commands/compact.d.ts +7 -0
- package/dist/commands/compact.js +1 -0
- package/dist/commands/customsubagents.d.ts +15 -0
- package/dist/commands/customsubagents.js +1 -0
- package/dist/commands/help.d.ts +9 -0
- package/dist/commands/help.js +1 -0
- package/dist/commands/mcp.d.ts +9 -0
- package/dist/commands/mcp.js +1 -0
- package/dist/commands/model.d.ts +22 -0
- package/dist/commands/model.js +1 -0
- package/dist/commands/models.d.ts +11 -0
- package/dist/commands/models.js +1 -0
- package/dist/commands/new.d.ts +7 -0
- package/dist/commands/new.js +1 -0
- package/dist/commands/plugin.d.ts +7 -0
- package/dist/commands/plugin.js +1 -0
- package/dist/commands/sandbox.d.ts +12 -0
- package/dist/commands/sandbox.js +1 -0
- package/dist/commands/showtool.d.ts +12 -0
- package/dist/commands/showtool.js +1 -0
- package/dist/commands/status.d.ts +24 -0
- package/dist/commands/status.js +1 -0
- package/dist/commands/stop.d.ts +10 -0
- package/dist/commands/stop.js +1 -0
- package/dist/commands/subagents.d.ts +12 -0
- package/dist/commands/subagents.js +1 -0
- package/dist/commands/usage.d.ts +25 -0
- package/dist/commands/usage.js +1 -0
- package/dist/commands/useplugin.d.ts +7 -0
- package/dist/commands/useplugin.js +1 -0
- package/dist/config-watcher.d.ts +14 -0
- package/dist/config-watcher.js +1 -0
- package/dist/config.d.ts +267 -0
- package/dist/config.js +1 -0
- package/dist/cron/cron-service.d.ts +57 -0
- package/dist/cron/cron-service.js +1 -0
- package/dist/cron/heartbeat-token.d.ts +29 -0
- package/dist/cron/heartbeat-token.js +1 -0
- package/dist/cron/schedule.d.ts +3 -0
- package/dist/cron/schedule.js +1 -0
- package/dist/cron/store.d.ts +4 -0
- package/dist/cron/store.js +1 -0
- package/dist/cron/types.d.ts +47 -0
- package/dist/cron/types.js +1 -0
- package/dist/gateway/bridge.d.ts +38 -0
- package/dist/gateway/bridge.js +1 -0
- package/dist/gateway/channel-manager.d.ts +45 -0
- package/dist/gateway/channel-manager.js +1 -0
- package/dist/gateway/channels/qr-image.d.ts +5 -0
- package/dist/gateway/channels/qr-image.js +1 -0
- package/dist/gateway/channels/telegram.d.ts +39 -0
- package/dist/gateway/channels/telegram.js +1 -0
- package/dist/gateway/channels/webchat.d.ts +51 -0
- package/dist/gateway/channels/webchat.js +1 -0
- package/dist/gateway/channels/whatsapp.d.ts +40 -0
- package/dist/gateway/channels/whatsapp.js +1 -0
- package/dist/gateway/node-registry.d.ts +38 -0
- package/dist/gateway/node-registry.js +1 -0
- package/dist/heracli/index.d.ts +3 -0
- package/dist/heracli/index.js +2 -0
- package/dist/heracli/logs.d.ts +13 -0
- package/dist/heracli/logs.js +1 -0
- package/dist/heracli/security/audit.d.ts +17 -0
- package/dist/heracli/security/audit.js +1 -0
- package/dist/heracli/security/checks/channel-policies.d.ts +6 -0
- package/dist/heracli/security/checks/channel-policies.js +1 -0
- package/dist/heracli/security/checks/credentials.d.ts +6 -0
- package/dist/heracli/security/checks/credentials.js +1 -0
- package/dist/heracli/security/checks/fs-permissions.d.ts +6 -0
- package/dist/heracli/security/checks/fs-permissions.js +1 -0
- package/dist/heracli/security/checks/network.d.ts +4 -0
- package/dist/heracli/security/checks/network.js +1 -0
- package/dist/heracli/security/report.d.ts +4 -0
- package/dist/heracli/security/report.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/installer/hera.d.ts +3 -0
- package/dist/installer/hera.js +2 -0
- package/dist/media/message-processor.d.ts +23 -0
- package/dist/media/message-processor.js +1 -0
- package/dist/memory/memory-manager.d.ts +21 -0
- package/dist/memory/memory-manager.js +1 -0
- package/dist/memory/memory-provider.d.ts +22 -0
- package/dist/memory/memory-provider.js +1 -0
- package/dist/memory/memory-search.d.ts +102 -0
- package/dist/memory/memory-search.js +1 -0
- package/dist/memory/recall-strategies.d.ts +2 -0
- package/dist/memory/recall-strategies.js +1 -0
- package/dist/nostromo/auth.d.ts +29 -0
- package/dist/nostromo/auth.js +1 -0
- package/dist/nostromo/nostromo.d.ts +23 -0
- package/dist/nostromo/nostromo.js +1 -0
- package/dist/nostromo/ui-html-layout.d.ts +3 -0
- package/dist/nostromo/ui-html-layout.js +1 -0
- package/dist/nostromo/ui-html-modals.d.ts +3 -0
- package/dist/nostromo/ui-html-modals.js +1 -0
- package/dist/nostromo/ui-js-agent.d.ts +3 -0
- package/dist/nostromo/ui-js-agent.js +1 -0
- package/dist/nostromo/ui-js-channels.d.ts +3 -0
- package/dist/nostromo/ui-js-channels.js +1 -0
- package/dist/nostromo/ui-js-competences.d.ts +3 -0
- package/dist/nostromo/ui-js-competences.js +1 -0
- package/dist/nostromo/ui-js-config.d.ts +3 -0
- package/dist/nostromo/ui-js-config.js +1 -0
- package/dist/nostromo/ui-js-core.d.ts +3 -0
- package/dist/nostromo/ui-js-core.js +1 -0
- package/dist/nostromo/ui-js-ops.d.ts +3 -0
- package/dist/nostromo/ui-js-ops.js +1 -0
- package/dist/nostromo/ui-js-prompts.d.ts +3 -0
- package/dist/nostromo/ui-js-prompts.js +1 -0
- package/dist/nostromo/ui-styles.d.ts +3 -0
- package/dist/nostromo/ui-styles.js +1 -0
- package/dist/nostromo/ui.d.ts +2 -0
- package/dist/nostromo/ui.js +1 -0
- package/dist/server.d.ts +80 -0
- package/dist/server.js +1 -0
- package/dist/stt/local-whisper.d.ts +9 -0
- package/dist/stt/local-whisper.js +1 -0
- package/dist/stt/openai-whisper.d.ts +14 -0
- package/dist/stt/openai-whisper.js +1 -0
- package/dist/stt/stt-loader.d.ts +4 -0
- package/dist/stt/stt-loader.js +1 -0
- package/dist/stt/stt-provider.d.ts +4 -0
- package/dist/stt/stt-provider.js +1 -0
- package/dist/tools/browser-tools.d.ts +9 -0
- package/dist/tools/browser-tools.js +1 -0
- package/dist/tools/cron-tools.d.ts +4 -0
- package/dist/tools/cron-tools.js +1 -0
- package/dist/tools/memory-tools.d.ts +3 -0
- package/dist/tools/memory-tools.js +1 -0
- package/dist/tools/message-tools.d.ts +5 -0
- package/dist/tools/message-tools.js +1 -0
- package/dist/tools/node-tools.d.ts +3 -0
- package/dist/tools/node-tools.js +1 -0
- package/dist/tools/server-tools.d.ts +2 -0
- package/dist/tools/server-tools.js +1 -0
- package/dist/tools/tts-tools.d.ts +3 -0
- package/dist/tools/tts-tools.js +1 -0
- package/dist/tts/tts-service.d.ts +19 -0
- package/dist/tts/tts-service.js +1 -0
- package/dist/utils/chunk.d.ts +3 -0
- package/dist/utils/chunk.js +1 -0
- package/dist/utils/logger.d.ts +16 -0
- package/dist/utils/logger.js +1 -0
- package/dist/utils/markdown/fences.d.ts +11 -0
- package/dist/utils/markdown/fences.js +1 -0
- package/dist/utils/markdown/ir.d.ts +33 -0
- package/dist/utils/markdown/ir.js +1 -0
- package/dist/utils/markdown/render.d.ts +19 -0
- package/dist/utils/markdown/render.js +1 -0
- package/dist/utils/markdown/tables.d.ts +3 -0
- package/dist/utils/markdown/tables.js +1 -0
- package/dist/utils/media-response.d.ts +29 -0
- package/dist/utils/media-response.js +1 -0
- package/dist/utils/package-paths.d.ts +5 -0
- package/dist/utils/package-paths.js +1 -0
- package/dist/utils/telegram-format.d.ts +13 -0
- package/dist/utils/telegram-format.js +1 -0
- package/installationPkg/.env.example +26 -0
- package/installationPkg/AGENTS.md +143 -0
- package/installationPkg/BOOTSTRAP.md +45 -0
- package/installationPkg/CBINT.json +16 -0
- package/installationPkg/HEARTBEAT.md +5 -0
- package/installationPkg/IDENTITY.md +7 -0
- package/installationPkg/SOUL.md +36 -0
- package/installationPkg/SYSTEM_PROMPT.md +55 -0
- package/installationPkg/SYSTEM_PROMPT_SUBAGENT.md +40 -0
- package/installationPkg/TOOLS.md +36 -0
- package/installationPkg/USER.md +11 -0
- package/installationPkg/config.example.yaml +291 -0
- package/package.json +95 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
import os
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
from fastapi import HTTPException
|
|
9
|
+
|
|
10
|
+
from local_places.schemas import (
|
|
11
|
+
LatLng,
|
|
12
|
+
LocationResolveRequest,
|
|
13
|
+
LocationResolveResponse,
|
|
14
|
+
PlaceDetails,
|
|
15
|
+
PlaceSummary,
|
|
16
|
+
ResolvedLocation,
|
|
17
|
+
SearchRequest,
|
|
18
|
+
SearchResponse,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
GOOGLE_PLACES_BASE_URL = os.getenv(
|
|
22
|
+
"GOOGLE_PLACES_BASE_URL", "https://places.googleapis.com/v1"
|
|
23
|
+
)
|
|
24
|
+
logger = logging.getLogger("local_places.google_places")
|
|
25
|
+
|
|
26
|
+
_PRICE_LEVEL_TO_ENUM = {
|
|
27
|
+
0: "PRICE_LEVEL_FREE",
|
|
28
|
+
1: "PRICE_LEVEL_INEXPENSIVE",
|
|
29
|
+
2: "PRICE_LEVEL_MODERATE",
|
|
30
|
+
3: "PRICE_LEVEL_EXPENSIVE",
|
|
31
|
+
4: "PRICE_LEVEL_VERY_EXPENSIVE",
|
|
32
|
+
}
|
|
33
|
+
_ENUM_TO_PRICE_LEVEL = {value: key for key, value in _PRICE_LEVEL_TO_ENUM.items()}
|
|
34
|
+
|
|
35
|
+
_SEARCH_FIELD_MASK = (
|
|
36
|
+
"places.id,"
|
|
37
|
+
"places.displayName,"
|
|
38
|
+
"places.formattedAddress,"
|
|
39
|
+
"places.location,"
|
|
40
|
+
"places.rating,"
|
|
41
|
+
"places.priceLevel,"
|
|
42
|
+
"places.types,"
|
|
43
|
+
"places.currentOpeningHours,"
|
|
44
|
+
"nextPageToken"
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
_DETAILS_FIELD_MASK = (
|
|
48
|
+
"id,"
|
|
49
|
+
"displayName,"
|
|
50
|
+
"formattedAddress,"
|
|
51
|
+
"location,"
|
|
52
|
+
"rating,"
|
|
53
|
+
"priceLevel,"
|
|
54
|
+
"types,"
|
|
55
|
+
"regularOpeningHours,"
|
|
56
|
+
"currentOpeningHours,"
|
|
57
|
+
"nationalPhoneNumber,"
|
|
58
|
+
"websiteUri"
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
_RESOLVE_FIELD_MASK = (
|
|
62
|
+
"places.id,"
|
|
63
|
+
"places.displayName,"
|
|
64
|
+
"places.formattedAddress,"
|
|
65
|
+
"places.location,"
|
|
66
|
+
"places.types"
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class _GoogleResponse:
|
|
71
|
+
def __init__(self, response: httpx.Response):
|
|
72
|
+
self.status_code = response.status_code
|
|
73
|
+
self._response = response
|
|
74
|
+
|
|
75
|
+
def json(self) -> dict[str, Any]:
|
|
76
|
+
return self._response.json()
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def text(self) -> str:
|
|
80
|
+
return self._response.text
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _api_headers(field_mask: str) -> dict[str, str]:
|
|
84
|
+
api_key = os.getenv("GOOGLE_PLACES_API_KEY")
|
|
85
|
+
if not api_key:
|
|
86
|
+
raise HTTPException(
|
|
87
|
+
status_code=500,
|
|
88
|
+
detail="GOOGLE_PLACES_API_KEY is not set.",
|
|
89
|
+
)
|
|
90
|
+
return {
|
|
91
|
+
"Content-Type": "application/json",
|
|
92
|
+
"X-Goog-Api-Key": api_key,
|
|
93
|
+
"X-Goog-FieldMask": field_mask,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _request(
|
|
98
|
+
method: str, url: str, payload: dict[str, Any] | None, field_mask: str
|
|
99
|
+
) -> _GoogleResponse:
|
|
100
|
+
try:
|
|
101
|
+
with httpx.Client(timeout=10.0) as client:
|
|
102
|
+
response = client.request(
|
|
103
|
+
method=method,
|
|
104
|
+
url=url,
|
|
105
|
+
headers=_api_headers(field_mask),
|
|
106
|
+
json=payload,
|
|
107
|
+
)
|
|
108
|
+
except httpx.HTTPError as exc:
|
|
109
|
+
raise HTTPException(status_code=502, detail="Google Places API unavailable.") from exc
|
|
110
|
+
|
|
111
|
+
return _GoogleResponse(response)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _build_text_query(request: SearchRequest) -> str:
|
|
115
|
+
keyword = request.filters.keyword if request.filters else None
|
|
116
|
+
if keyword:
|
|
117
|
+
return f"{request.query} {keyword}".strip()
|
|
118
|
+
return request.query
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def _build_search_body(request: SearchRequest) -> dict[str, Any]:
|
|
122
|
+
body: dict[str, Any] = {
|
|
123
|
+
"textQuery": _build_text_query(request),
|
|
124
|
+
"pageSize": request.limit,
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if request.page_token:
|
|
128
|
+
body["pageToken"] = request.page_token
|
|
129
|
+
|
|
130
|
+
if request.location_bias:
|
|
131
|
+
body["locationBias"] = {
|
|
132
|
+
"circle": {
|
|
133
|
+
"center": {
|
|
134
|
+
"latitude": request.location_bias.lat,
|
|
135
|
+
"longitude": request.location_bias.lng,
|
|
136
|
+
},
|
|
137
|
+
"radius": request.location_bias.radius_m,
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if request.filters:
|
|
142
|
+
filters = request.filters
|
|
143
|
+
if filters.types:
|
|
144
|
+
body["includedType"] = filters.types[0]
|
|
145
|
+
if filters.open_now is not None:
|
|
146
|
+
body["openNow"] = filters.open_now
|
|
147
|
+
if filters.min_rating is not None:
|
|
148
|
+
body["minRating"] = filters.min_rating
|
|
149
|
+
if filters.price_levels:
|
|
150
|
+
body["priceLevels"] = [
|
|
151
|
+
_PRICE_LEVEL_TO_ENUM[level] for level in filters.price_levels
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
return body
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _parse_lat_lng(raw: dict[str, Any] | None) -> LatLng | None:
|
|
158
|
+
if not raw:
|
|
159
|
+
return None
|
|
160
|
+
latitude = raw.get("latitude")
|
|
161
|
+
longitude = raw.get("longitude")
|
|
162
|
+
if latitude is None or longitude is None:
|
|
163
|
+
return None
|
|
164
|
+
return LatLng(lat=latitude, lng=longitude)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def _parse_display_name(raw: dict[str, Any] | None) -> str | None:
|
|
168
|
+
if not raw:
|
|
169
|
+
return None
|
|
170
|
+
return raw.get("text")
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def _parse_open_now(raw: dict[str, Any] | None) -> bool | None:
|
|
174
|
+
if not raw:
|
|
175
|
+
return None
|
|
176
|
+
return raw.get("openNow")
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def _parse_hours(raw: dict[str, Any] | None) -> list[str] | None:
|
|
180
|
+
if not raw:
|
|
181
|
+
return None
|
|
182
|
+
return raw.get("weekdayDescriptions")
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def _parse_price_level(raw: str | None) -> int | None:
|
|
186
|
+
if not raw:
|
|
187
|
+
return None
|
|
188
|
+
return _ENUM_TO_PRICE_LEVEL.get(raw)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def search_places(request: SearchRequest) -> SearchResponse:
|
|
192
|
+
url = f"{GOOGLE_PLACES_BASE_URL}/places:searchText"
|
|
193
|
+
response = _request("POST", url, _build_search_body(request), _SEARCH_FIELD_MASK)
|
|
194
|
+
|
|
195
|
+
if response.status_code >= 400:
|
|
196
|
+
logger.error(
|
|
197
|
+
"Google Places API error %s. response=%s",
|
|
198
|
+
response.status_code,
|
|
199
|
+
response.text,
|
|
200
|
+
)
|
|
201
|
+
raise HTTPException(
|
|
202
|
+
status_code=502,
|
|
203
|
+
detail=f"Google Places API error ({response.status_code}).",
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
try:
|
|
207
|
+
payload = response.json()
|
|
208
|
+
except ValueError as exc:
|
|
209
|
+
logger.error(
|
|
210
|
+
"Google Places API returned invalid JSON. response=%s",
|
|
211
|
+
response.text,
|
|
212
|
+
)
|
|
213
|
+
raise HTTPException(status_code=502, detail="Invalid Google response.") from exc
|
|
214
|
+
|
|
215
|
+
places = payload.get("places", [])
|
|
216
|
+
results = []
|
|
217
|
+
for place in places:
|
|
218
|
+
results.append(
|
|
219
|
+
PlaceSummary(
|
|
220
|
+
place_id=place.get("id", ""),
|
|
221
|
+
name=_parse_display_name(place.get("displayName")),
|
|
222
|
+
address=place.get("formattedAddress"),
|
|
223
|
+
location=_parse_lat_lng(place.get("location")),
|
|
224
|
+
rating=place.get("rating"),
|
|
225
|
+
price_level=_parse_price_level(place.get("priceLevel")),
|
|
226
|
+
types=place.get("types"),
|
|
227
|
+
open_now=_parse_open_now(place.get("currentOpeningHours")),
|
|
228
|
+
)
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
return SearchResponse(
|
|
232
|
+
results=results,
|
|
233
|
+
next_page_token=payload.get("nextPageToken"),
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def get_place_details(place_id: str) -> PlaceDetails:
|
|
238
|
+
url = f"{GOOGLE_PLACES_BASE_URL}/places/{place_id}"
|
|
239
|
+
response = _request("GET", url, None, _DETAILS_FIELD_MASK)
|
|
240
|
+
|
|
241
|
+
if response.status_code >= 400:
|
|
242
|
+
logger.error(
|
|
243
|
+
"Google Places API error %s. response=%s",
|
|
244
|
+
response.status_code,
|
|
245
|
+
response.text,
|
|
246
|
+
)
|
|
247
|
+
raise HTTPException(
|
|
248
|
+
status_code=502,
|
|
249
|
+
detail=f"Google Places API error ({response.status_code}).",
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
try:
|
|
253
|
+
payload = response.json()
|
|
254
|
+
except ValueError as exc:
|
|
255
|
+
logger.error(
|
|
256
|
+
"Google Places API returned invalid JSON. response=%s",
|
|
257
|
+
response.text,
|
|
258
|
+
)
|
|
259
|
+
raise HTTPException(status_code=502, detail="Invalid Google response.") from exc
|
|
260
|
+
|
|
261
|
+
return PlaceDetails(
|
|
262
|
+
place_id=payload.get("id", place_id),
|
|
263
|
+
name=_parse_display_name(payload.get("displayName")),
|
|
264
|
+
address=payload.get("formattedAddress"),
|
|
265
|
+
location=_parse_lat_lng(payload.get("location")),
|
|
266
|
+
rating=payload.get("rating"),
|
|
267
|
+
price_level=_parse_price_level(payload.get("priceLevel")),
|
|
268
|
+
types=payload.get("types"),
|
|
269
|
+
phone=payload.get("nationalPhoneNumber"),
|
|
270
|
+
website=payload.get("websiteUri"),
|
|
271
|
+
hours=_parse_hours(payload.get("regularOpeningHours")),
|
|
272
|
+
open_now=_parse_open_now(payload.get("currentOpeningHours")),
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def resolve_locations(request: LocationResolveRequest) -> LocationResolveResponse:
|
|
277
|
+
url = f"{GOOGLE_PLACES_BASE_URL}/places:searchText"
|
|
278
|
+
body = {"textQuery": request.location_text, "pageSize": request.limit}
|
|
279
|
+
response = _request("POST", url, body, _RESOLVE_FIELD_MASK)
|
|
280
|
+
|
|
281
|
+
if response.status_code >= 400:
|
|
282
|
+
logger.error(
|
|
283
|
+
"Google Places API error %s. response=%s",
|
|
284
|
+
response.status_code,
|
|
285
|
+
response.text,
|
|
286
|
+
)
|
|
287
|
+
raise HTTPException(
|
|
288
|
+
status_code=502,
|
|
289
|
+
detail=f"Google Places API error ({response.status_code}).",
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
try:
|
|
293
|
+
payload = response.json()
|
|
294
|
+
except ValueError as exc:
|
|
295
|
+
logger.error(
|
|
296
|
+
"Google Places API returned invalid JSON. response=%s",
|
|
297
|
+
response.text,
|
|
298
|
+
)
|
|
299
|
+
raise HTTPException(status_code=502, detail="Invalid Google response.") from exc
|
|
300
|
+
|
|
301
|
+
places = payload.get("places", [])
|
|
302
|
+
results = []
|
|
303
|
+
for place in places:
|
|
304
|
+
results.append(
|
|
305
|
+
ResolvedLocation(
|
|
306
|
+
place_id=place.get("id", ""),
|
|
307
|
+
name=_parse_display_name(place.get("displayName")),
|
|
308
|
+
address=place.get("formattedAddress"),
|
|
309
|
+
location=_parse_lat_lng(place.get("location")),
|
|
310
|
+
types=place.get("types"),
|
|
311
|
+
)
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
return LocationResolveResponse(results=results)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
from fastapi import FastAPI, Request
|
|
5
|
+
from fastapi.encoders import jsonable_encoder
|
|
6
|
+
from fastapi.exceptions import RequestValidationError
|
|
7
|
+
from fastapi.responses import JSONResponse
|
|
8
|
+
|
|
9
|
+
from local_places.google_places import get_place_details, resolve_locations, search_places
|
|
10
|
+
from local_places.schemas import (
|
|
11
|
+
LocationResolveRequest,
|
|
12
|
+
LocationResolveResponse,
|
|
13
|
+
PlaceDetails,
|
|
14
|
+
SearchRequest,
|
|
15
|
+
SearchResponse,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
app = FastAPI(
|
|
19
|
+
title="My API",
|
|
20
|
+
servers=[{"url": os.getenv("OPENAPI_SERVER_URL", "http://maxims-macbook-air:8000")}],
|
|
21
|
+
)
|
|
22
|
+
logger = logging.getLogger("local_places.validation")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@app.get("/ping")
|
|
26
|
+
def ping() -> dict[str, str]:
|
|
27
|
+
return {"message": "pong"}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@app.exception_handler(RequestValidationError)
|
|
31
|
+
async def validation_exception_handler(
|
|
32
|
+
request: Request, exc: RequestValidationError
|
|
33
|
+
) -> JSONResponse:
|
|
34
|
+
logger.error(
|
|
35
|
+
"Validation error on %s %s. body=%s errors=%s",
|
|
36
|
+
request.method,
|
|
37
|
+
request.url.path,
|
|
38
|
+
exc.body,
|
|
39
|
+
exc.errors(),
|
|
40
|
+
)
|
|
41
|
+
return JSONResponse(
|
|
42
|
+
status_code=422,
|
|
43
|
+
content=jsonable_encoder({"detail": exc.errors()}),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@app.post("/places/search", response_model=SearchResponse)
|
|
48
|
+
def places_search(request: SearchRequest) -> SearchResponse:
|
|
49
|
+
return search_places(request)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@app.get("/places/{place_id}", response_model=PlaceDetails)
|
|
53
|
+
def places_details(place_id: str) -> PlaceDetails:
|
|
54
|
+
return get_place_details(place_id)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@app.post("/locations/resolve", response_model=LocationResolveResponse)
|
|
58
|
+
def locations_resolve(request: LocationResolveRequest) -> LocationResolveResponse:
|
|
59
|
+
return resolve_locations(request)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
if __name__ == "__main__":
|
|
63
|
+
import uvicorn
|
|
64
|
+
|
|
65
|
+
uvicorn.run("local_places.main:app", host="0.0.0.0", port=8000)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field, field_validator
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class LatLng(BaseModel):
|
|
7
|
+
lat: float = Field(ge=-90, le=90)
|
|
8
|
+
lng: float = Field(ge=-180, le=180)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class LocationBias(BaseModel):
|
|
12
|
+
lat: float = Field(ge=-90, le=90)
|
|
13
|
+
lng: float = Field(ge=-180, le=180)
|
|
14
|
+
radius_m: float = Field(gt=0)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Filters(BaseModel):
|
|
18
|
+
types: list[str] | None = None
|
|
19
|
+
open_now: bool | None = None
|
|
20
|
+
min_rating: float | None = Field(default=None, ge=0, le=5)
|
|
21
|
+
price_levels: list[int] | None = None
|
|
22
|
+
keyword: str | None = Field(default=None, min_length=1)
|
|
23
|
+
|
|
24
|
+
@field_validator("types")
|
|
25
|
+
@classmethod
|
|
26
|
+
def validate_types(cls, value: list[str] | None) -> list[str] | None:
|
|
27
|
+
if value is None:
|
|
28
|
+
return value
|
|
29
|
+
if len(value) > 1:
|
|
30
|
+
raise ValueError(
|
|
31
|
+
"Only one type is supported. Use query/keyword for additional filtering."
|
|
32
|
+
)
|
|
33
|
+
return value
|
|
34
|
+
|
|
35
|
+
@field_validator("price_levels")
|
|
36
|
+
@classmethod
|
|
37
|
+
def validate_price_levels(cls, value: list[int] | None) -> list[int] | None:
|
|
38
|
+
if value is None:
|
|
39
|
+
return value
|
|
40
|
+
invalid = [level for level in value if level not in range(0, 5)]
|
|
41
|
+
if invalid:
|
|
42
|
+
raise ValueError("price_levels must be integers between 0 and 4.")
|
|
43
|
+
return value
|
|
44
|
+
|
|
45
|
+
@field_validator("min_rating")
|
|
46
|
+
@classmethod
|
|
47
|
+
def validate_min_rating(cls, value: float | None) -> float | None:
|
|
48
|
+
if value is None:
|
|
49
|
+
return value
|
|
50
|
+
if (value * 2) % 1 != 0:
|
|
51
|
+
raise ValueError("min_rating must be in 0.5 increments.")
|
|
52
|
+
return value
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class SearchRequest(BaseModel):
|
|
56
|
+
query: str = Field(min_length=1)
|
|
57
|
+
location_bias: LocationBias | None = None
|
|
58
|
+
filters: Filters | None = None
|
|
59
|
+
limit: int = Field(default=10, ge=1, le=20)
|
|
60
|
+
page_token: str | None = None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class PlaceSummary(BaseModel):
|
|
64
|
+
place_id: str
|
|
65
|
+
name: str | None = None
|
|
66
|
+
address: str | None = None
|
|
67
|
+
location: LatLng | None = None
|
|
68
|
+
rating: float | None = None
|
|
69
|
+
price_level: int | None = None
|
|
70
|
+
types: list[str] | None = None
|
|
71
|
+
open_now: bool | None = None
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class SearchResponse(BaseModel):
|
|
75
|
+
results: list[PlaceSummary]
|
|
76
|
+
next_page_token: str | None = None
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class LocationResolveRequest(BaseModel):
|
|
80
|
+
location_text: str = Field(min_length=1)
|
|
81
|
+
limit: int = Field(default=5, ge=1, le=10)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class ResolvedLocation(BaseModel):
|
|
85
|
+
place_id: str
|
|
86
|
+
name: str | None = None
|
|
87
|
+
address: str | None = None
|
|
88
|
+
location: LatLng | None = None
|
|
89
|
+
types: list[str] | None = None
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class LocationResolveResponse(BaseModel):
|
|
93
|
+
results: list[ResolvedLocation]
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class PlaceDetails(BaseModel):
|
|
97
|
+
place_id: str
|
|
98
|
+
name: str | None = None
|
|
99
|
+
address: str | None = None
|
|
100
|
+
location: LatLng | None = None
|
|
101
|
+
rating: float | None = None
|
|
102
|
+
price_level: int | None = None
|
|
103
|
+
types: list[str] | None = None
|
|
104
|
+
phone: str | None = None
|
|
105
|
+
website: str | None = None
|
|
106
|
+
hours: list[str] | None = None
|
|
107
|
+
open_now: bool | None = None
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: markitdown
|
|
3
|
+
description: Convert various file formats (PDF, Office docs, images, audio, web content, CSV, JSON, XML) to Markdown. Use when converting documents for LLM processing or text extraction.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# MarkItDown
|
|
7
|
+
|
|
8
|
+
Convert 20+ file formats to clean Markdown optimized for LLM processing.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
- Converting PDF, Word, PowerPoint, Excel to Markdown
|
|
12
|
+
- Extracting text from images (OCR)
|
|
13
|
+
- Transcribing audio files
|
|
14
|
+
- Extracting YouTube video transcripts
|
|
15
|
+
- Converting HTML, EPUB, RSS to Markdown
|
|
16
|
+
- Converting CSV, JSON, XML to Markdown tables
|
|
17
|
+
- Batch processing multiple files
|
|
18
|
+
|
|
19
|
+
## Supported Formats
|
|
20
|
+
|
|
21
|
+
| Category | Formats |
|
|
22
|
+
|----------|---------|
|
|
23
|
+
| Documents | PDF, DOCX, PPTX, XLSX, XLS |
|
|
24
|
+
| Images | JPEG, PNG, GIF (with OCR + EXIF) |
|
|
25
|
+
| Audio | WAV, MP3, etc. (speech transcription) |
|
|
26
|
+
| Web | HTML, EPUB, YouTube URLs, RSS |
|
|
27
|
+
| Data | CSV, JSON, XML |
|
|
28
|
+
| Archives | ZIP (processes all files inside) |
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Full installation (all features)
|
|
34
|
+
uv pip install 'markitdown[all]'
|
|
35
|
+
|
|
36
|
+
# Or modular (only what you need)
|
|
37
|
+
uv pip install 'markitdown[pdf]'
|
|
38
|
+
uv pip install 'markitdown[docx]'
|
|
39
|
+
uv pip install 'markitdown[pptx]'
|
|
40
|
+
uv pip install 'markitdown[xlsx]'
|
|
41
|
+
uv pip install 'markitdown[audio]'
|
|
42
|
+
uv pip install 'markitdown[youtube]'
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Requires Python 3.10+.
|
|
46
|
+
|
|
47
|
+
## Command Line Usage
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
markitdown document.pdf # Print to stdout
|
|
51
|
+
markitdown document.pdf -o output.md # Save to file
|
|
52
|
+
markitdown presentation.pptx -o slides.md # PowerPoint
|
|
53
|
+
markitdown spreadsheet.xlsx -o data.md # Excel
|
|
54
|
+
markitdown image.jpg -o extracted.md # OCR
|
|
55
|
+
markitdown "https://youtube.com/watch?v=ID" -o transcript.md # YouTube
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Batch Processing
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Convert all PDFs in a directory
|
|
62
|
+
for file in documents/*.pdf; do
|
|
63
|
+
markitdown "$file" -o "markdown/$(basename "$file" .pdf).md"
|
|
64
|
+
done
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Python API
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from markitdown import MarkItDown
|
|
71
|
+
|
|
72
|
+
md = MarkItDown()
|
|
73
|
+
|
|
74
|
+
# Basic conversion
|
|
75
|
+
result = md.convert("document.pdf")
|
|
76
|
+
print(result.text_content)
|
|
77
|
+
|
|
78
|
+
# With LLM-powered image descriptions
|
|
79
|
+
from openai import OpenAI
|
|
80
|
+
client = OpenAI()
|
|
81
|
+
md = MarkItDown(llm_client=client, llm_model="gpt-4o")
|
|
82
|
+
result = md.convert("presentation.pptx")
|
|
83
|
+
|
|
84
|
+
# ZIP archive (all files inside)
|
|
85
|
+
result = md.convert("archive.zip")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Output
|
|
89
|
+
- Clean, token-efficient Markdown
|
|
90
|
+
- Preserves headings, lists, tables, links
|
|
91
|
+
- Includes metadata where relevant (EXIF, document properties)
|
|
92
|
+
- No temporary files (streaming approach)
|
|
93
|
+
|
|
94
|
+
## Resources
|
|
95
|
+
- GitHub: https://github.com/microsoft/markitdown
|
|
96
|
+
- PyPI: https://pypi.org/project/markitdown/
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mcporter
|
|
3
|
+
description: Use the mcporter CLI to list, configure, auth, and call MCP servers/tools directly (HTTP or stdio), including ad-hoc servers, config edits, and CLI/type generation.
|
|
4
|
+
homepage: http://mcporter.dev
|
|
5
|
+
metadata:
|
|
6
|
+
{
|
|
7
|
+
"openclaw":
|
|
8
|
+
{
|
|
9
|
+
"emoji": "📦",
|
|
10
|
+
"requires": { "bins": ["mcporter"] },
|
|
11
|
+
"install":
|
|
12
|
+
[
|
|
13
|
+
{
|
|
14
|
+
"id": "node",
|
|
15
|
+
"kind": "node",
|
|
16
|
+
"package": "mcporter",
|
|
17
|
+
"bins": ["mcporter"],
|
|
18
|
+
"label": "Install mcporter (node)",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# mcporter
|
|
26
|
+
|
|
27
|
+
Use `mcporter` to work with MCP servers directly.
|
|
28
|
+
|
|
29
|
+
Quick start
|
|
30
|
+
|
|
31
|
+
- `mcporter list`
|
|
32
|
+
- `mcporter list <server> --schema`
|
|
33
|
+
- `mcporter call <server.tool> key=value`
|
|
34
|
+
|
|
35
|
+
Call tools
|
|
36
|
+
|
|
37
|
+
- Selector: `mcporter call linear.list_issues team=ENG limit:5`
|
|
38
|
+
- Function syntax: `mcporter call "linear.create_issue(title: \"Bug\")"`
|
|
39
|
+
- Full URL: `mcporter call https://api.example.com/mcp.fetch url:https://example.com`
|
|
40
|
+
- Stdio: `mcporter call --stdio "bun run ./server.ts" scrape url=https://example.com`
|
|
41
|
+
- JSON payload: `mcporter call <server.tool> --args '{"limit":5}'`
|
|
42
|
+
|
|
43
|
+
Auth + config
|
|
44
|
+
|
|
45
|
+
- OAuth: `mcporter auth <server | url> [--reset]`
|
|
46
|
+
- Config: `mcporter config list|get|add|remove|import|login|logout`
|
|
47
|
+
|
|
48
|
+
Daemon
|
|
49
|
+
|
|
50
|
+
- `mcporter daemon start|status|stop|restart`
|
|
51
|
+
|
|
52
|
+
Codegen
|
|
53
|
+
|
|
54
|
+
- CLI: `mcporter generate-cli --server <name>` or `--command <url>`
|
|
55
|
+
- Inspect: `mcporter inspect-cli <path> [--json]`
|
|
56
|
+
- TS: `mcporter emit-ts <server> --mode client|types`
|
|
57
|
+
|
|
58
|
+
Notes
|
|
59
|
+
|
|
60
|
+
- Config default: `./config/mcporter.json` (override with `--config`).
|
|
61
|
+
- Prefer `--output json` for machine-readable results.
|