Skip to content

Conversation

@zbejas
Copy link
Owner

@zbejas zbejas commented Aug 7, 2025

This pull request improves the reliability and structure of extracting YouTube links using Ollama by enforcing a strict JSON response format, updating the prompt instructions, and enhancing the parsing logic to handle structured responses. It also updates documentation to reflect these changes.

Prompt and API integration improvements:

  • The OLLAMA_PROMPT in .env.example now instructs Ollama to return a JSON object with a links array, and not to include any extra text or formatting. It also clarifies the inclusion criteria for links and provides concrete response examples. [1] [2]
  • The Ollama API call in extractLinksWithOllama (src/utils/youtube.ts) now explicitly requests a JSON schema with a links array, ensuring the model's output is structured and predictable.

Parsing and error handling enhancements:

  • The link extraction logic in extractLinksWithOllama has been updated to first attempt parsing the response as structured JSON, handle missing or empty links properties, and fall back to legacy parsing if needed. This increases robustness and backward compatibility. [1] [2]

Documentation updates:

  • The README.md has been updated to indicate that OLLAMA_URL and OLLAMA_MODEL now default to None if not set, reflecting the new configuration approach.

@zbejas zbejas merged commit 31450c4 into main Aug 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants