Commit Graph

8 Commits

Author SHA1 Message Date
9421f2847f fix: Improve extraction prompt with JSON structure and fix fact parsing
- Updated prompt to specify expected JSON structure for facts and entities
- Added 'text' field support in fact parsing (alongside 'full_text')
- Listed explicit type values for facts and entities

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 21:14:56 +01:00
624114d443 fix: Remove max_tokens parameter that triggered Gemini safety filters
Testing revealed that max_tokens=2000 parameter causes Gemini to block
requests with safety filters, even for safe content.

Removed max_tokens from generate_text() call - Gemini will use default.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 21:10:45 +01:00
ac0aceb30e fix: Reduce chunk size and truncate prompts for Gemini safety filters
Testing revealed that Gemini 2.5 safety filters block texts longer than
~2000 chars. Applied two fixes:

1. Truncate chunk text to 2000 chars in _extract_with_ai() as safety net
2. Reduce MAX_CHUNK_SIZE from 1000 to 500 tokens (~2000 chars)

This ensures all AI extraction requests stay within Gemini's safe limits.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 21:05:48 +01:00
4045106b3c fix: Ultra-simplified extraction prompt to avoid Gemini safety filters
The complex JSON schema with pipe characters was triggering Gemini 2.5's
safety filters. Simplified to minimal prompt that still produces valid output.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 20:59:00 +01:00
e1f29229a3 fix(zopk): Uproszczone prompty ekstrakcji - rozwiązanie safety filters
Problem: Połączenie skomplikowanego system_prompt + user_prompt
         wyzwalało safety filters Gemini mimo płatnego API

Rozwiązanie:
- Usunięto system_prompt (pusty string)
- Uproszczono user_prompt do minimum
- Zachowano niezbędny format JSON

Testowane: prosty prompt działa, pełny przebieg do weryfikacji

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 20:54:22 +01:00
27b03eb051 fix(zopk): Neutralne prompty ekstrakcji - unikanie safety filters
Problem: Gemini blokował ekstrakcję z artykułów o energetyce
Rozwiązanie: Bardziej neutralne sformułowania promptów
- Podkreślono że to analiza PUBLICZNYCH artykułów prasowych
- Usunięto wrażliwe słowa kluczowe (nuclear, defense)
- Zmieniono 'extract' na 'identify'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 20:42:05 +01:00
cd2db86a95 fix(zopk): Naprawiono błąd system_prompt w AI extraction
Problem: GeminiService.generate_text() nie obsługuje parametru system_prompt
Rozwiązanie: Połączono system_prompt z user_prompt w jeden full_prompt

Dotyczy: ekstrakcji faktów, encji i relacji z artykułów ZOPK

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 20:37:09 +01:00
1b4cd31c41 feat(zopk): Knowledge Base + NordaGPT integration (FAZY 0-3)
FAZA 0 - Web Scraping:
- Migracja 015: pola full_content, scrape_status w zopk_news
- zopk_content_scraper.py: scraper z rate limiting i selektorami

FAZA 1 - Knowledge Extraction:
- zopk_knowledge_service.py: chunking, facts, entities extraction
- Endpointy /admin/zopk/knowledge/extract

FAZA 2 - Embeddings:
- gemini_service.py: generate_embedding(), generate_embeddings_batch()
- Model text-embedding-004 (768 dimensions)

FAZA 3 - NordaGPT Integration:
- nordabiz_chat.py: _is_zopk_query(), _get_zopk_knowledge_context()
- System prompt z bazą wiedzy ZOPK
- Semantic search w kontekście chatu

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 20:15:30 +01:00