Markdown output support - #13
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes SerpApi tool output Markdown-first across the library, introducing an explicit response_format switch for callers that still need JSON, and updates filtering/limits to apply consistently to Markdown outputs while preserving important nested/detail sections.
Changes:
- Add
SearchResultFormatand wireresponse_formatthrough all public tool factories andSearchRuntime(Markdown default; JSON opt-in). - Implement Markdown compact/full filtering and
result_limitenforcement via Mistune-based Markdown parsing/rendering. - Update tests, examples, and docs to reflect Markdown-first behavior; refresh Great Docs configuration/assets.
Reviewed changes
Copilot reviewed 56 out of 58 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Lock updates for new runtime/docs dependencies (Mistune, Great Docs/Griffe bumps). |
| tox.ini | Excludes a problematic litellm version for py310 env. |
| tests/test_travel_tools.py | Updates test fake client to support Markdown default / JSON opt-in. |
| tests/test_shared.py | Updates runtime tests to opt into JSON where structured assertions are required. |
| tests/test_result_limit.py | Ensures factories/tests request JSON explicitly when parsing. |
| tests/test_query_tools.py | Updates query tool tests for Markdown default / JSON opt-in. |
| tests/test_project_metadata.py | Updates public API/export assertions and runtime dependency expectations. |
| tests/test_markdown_output.py | New test suite covering Markdown formatting/compact/full/limits/error handling. |
| tests/test_live.py | Adds live assertions for Markdown default behavior and result limiting. |
| tests/test_live_adapters.py | Updates live adapter smoke to request JSON explicitly. |
| tests/test_cookbook.py | Removes an environment-template assertion; retains cookbook coverage checks. |
| tests/test_adapters.py | Updates adapter tests to expect Markdown payloads by default. |
| tests/integration_agents/test_non_openai_adapter_invocation.py | Updates integration expectations from JSON payloads to Markdown text. |
| tests/integration_agents/test_agent_provider_smoke.py | Adds semantic-kernel provider case and adjusts prompt/tool naming. |
| tests/integration_agents/provider_helpers.py | Adds semantic-kernel provider runner implementation. |
| tests/integration_agents/conftest.py | Updates fake server client to return Markdown when output=md. |
| tests/clean_install_smoke.py | Extends clean-install smoke to validate Markdown default + JSON opt-in path. |
| src/serpapi_search_tools/_travel_tools.py | Adds response_format plumbed through travel tool constructors. |
| src/serpapi_search_tools/_shared.py | Core: adds SearchResultFormat, Markdown parsing/transforming, and runtime dispatch. |
| src/serpapi_search_tools/_query_tools.py | Adds response_format to query tool constructors and runtime wiring. |
| src/serpapi_search_tools/init.py | Exposes SearchResultFormat publicly. |
| README.md | Documents response_format and Markdown-first usage with JSON opt-in snippet. |
| pyproject.toml | Adds mistune runtime dependency; bumps docs deps bounds. |
| great-docs.yml | Updates Great Docs configuration, logo/favicon, and header asset cache-busting. |
| examples/semantic_kernel_openai.py | Updates Semantic Kernel example to new invocation pattern/settings types. |
| examples/README.md | Updates examples descriptions for Markdown-first behavior. |
| examples/direct_travel.py | Requests JSON explicitly where examples parse structured fields. |
| examples/direct_search.py | Demonstrates Markdown default and JSON opt-in side-by-side. |
| examples/direct_regioned_search.py | Requests JSON explicitly for parsing. |
| examples/direct_multi_search.py | Requests JSON explicitly for parsing/aggregation. |
| examples/direct_marketplace_comparison.py | Requests JSON explicitly for parsing/normalization. |
| examples/direct_cached_search.py | Requests JSON explicitly for caching/field access. |
| examples/_logging_client.py | Supports logging for both Markdown and JSON SerpApi responses. |
| docs/user_guide/20-debugging.qmd | Updates debugging guidance to use response_format=...JSON. |
| docs/user_guide/19-managing_llm_context.qmd | Expands guidance to include Markdown/JSON choice and Markdown row limiting. |
| docs/user_guide/18-travel_explore_search.qmd | Adds response_format to documented options. |
| docs/user_guide/17-flights_search.qmd | Adds response_format to documented options. |
| docs/user_guide/16-hotels_search.qmd | Adds response_format to documented options. |
| docs/user_guide/15-videos_search.qmd | Adds response_format to documented options. |
| docs/user_guide/14-shopping_search.qmd | Adds response_format to documented options. |
| docs/user_guide/13-images_search.qmd | Adds response_format to documented options. |
| docs/user_guide/12-maps_search.qmd | Documents place_results behavior and response_format. |
| docs/user_guide/11-news_search.qmd | Adds response_format to documented options. |
| docs/user_guide/10-web_search.qmd | Adds response_format to documented options. |
| docs/user_guide/08-examples.qmd | Updates narrative to reflect Markdown default and JSON opt-in. |
| docs/user_guide/05-usage.qmd | Updates “call directly” snippet to show Markdown default. |
| docs/user_guide/04-configuration.qmd | Adds a section explaining Markdown vs JSON configuration and implications. |
| docs/user_guide/02-quickstart.qmd | Updates quickstart narrative from JSON to Markdown outputs. |
| docs/user_guide/01-introduction.qmd | Updates intro examples and explanation for Markdown default. |
| docs/sdk_examples/openai_agents.qmd | Updates SDK example narrative to Markdown-first. |
| docs/cookbook/semantic-kernel.qmd | Updates cookbook narrative/examples to prompt-based SK invocation. |
| docs/cookbook/index.qmd | Notes cookbook uses compact Markdown and doesn’t parse JSON. |
| cookbook/semantic-kernel/README.md | Updates cookbook README narrative for new SK flow. |
| cookbook/semantic-kernel/main.py | Updates cookbook SK script to prompt invocation pattern. |
| cookbook/README.md | Notes cookbook agents consume compact Markdown by default. |
| assets/serpapi-logo.svg | Adds SerpApi logo asset for docs theme. |
| assets/docs-mobile.js | Adjusts homepage/section detection for updated Great Docs routing. |
| assets/docs-mobile.css | Updates mobile CSS overrides for new Great Docs behavior/layout. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @@ -1,9 +1,5 @@ | |||
| /* Mobile corrections layered over Great Docs 0.14. */ | |||
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
response_formatfor callers that need explicit JSON.result_limitto Markdown while preserving nested details, errors, unknown sections, and exact Maps place results.