TATECHATLAS
◎ English
Home / Topics

Artificial intelligence: models and practical tasks

Language models, automation, machine learning, text, images and audio: explanations, guides and practical tips.

Explore approaches, choose models and evaluate results. This section covers context, reliable outputs, automation and different data types. Search and RAG are one direction within the section. Time series and forecasting belong to mathematics and models.

Materials

30 materials

How sort_keys in json.dumps Gives Deterministic Key Order for Comparing Model JSON Responses

sort_keys=True makes json.dumps emit dictionary keys in sorted order, so two JSON responses with the same data but different key order serialize to identical strings. Sorting happens on the original Python keys before they are converted to JSON strings, so numeric keys sort by value.

python / json / json.dumps / sort_keys / testing / deterministic-serialization / regression-tests

Interpreting Azure AI Search Hybrid Scores: RRF, Small Values and Cross-Query Limits

Azure AI Search hybrid queries combine full-text and vector search using Reciprocal Rank Fusion (RRF). The @search.score field reflects this fusion, often appearing small due to RRF’s reciprocal rank weighting. This score cannot be directly compared across queries because it depends on the relative ranking within each query’s result set. Practical guidance includes using ranking order instead of absolute scores and understanding when semantic ranking alters the relevance signal.

Azure AI Search / Hybrid Search / Reciprocal Rank Fusion / RRF / Vector Search / Full-Text Search / Semantic Ranking / Relevance Scoring

Handling Control Characters in Model JSON Output

This article explains how to address control characters emitted by language models in JSON output, detailing the default strict mode in Python's json.loads and strategies for graceful degradation when encountering these characters.

JSON / Python / JSONDecodeError / Control Characters / Strict Mode

Python json.dump Is Not a Framed Protocol: Why Repeated Calls Produce Invalid JSON and How to Serialize Multiple LLM Responses Safely

Python's json module explicitly warns that JSON lacks framing, so calling dump() twice on the same file object writes two adjacent documents that json.load() cannot parse. The fix is to collect objects into a list and dump once, or use newline-delimited JSON with raw_decode for streaming scenarios.

python / json / serialization / llm / json-lines / framing / json-schema / streaming

Detecting Duplicate JSON Keys in LLM Output with Python's object_pairs_hook

Python's json.loads silently keeps only the last value when a JSON object contains duplicate keys, discarding earlier ones without warning. The object_pairs_hook parameter intercepts the full ordered list of key-value pairs before dict construction, enabling explicit duplicate detection at parse time.

json / object_pairs_hook / duplicate-keys / LLM-output / python / parsing / validation

Filtered Vector Search Strategy: Applying Filters to Vector Queries in Azure AI Search

Filtered vector search in Azure AI Search combines vector similarity with metadata filtering. Pre-filtering reduces the candidate set before scoring, potentially lowering latency but risking recall loss. Post-filtering preserves recall but may return fewer results. Testing both modes is essential to find the right trade-off for your data.

Azure AI Search / vector search / filtered vector search / hybrid search / pre-filter / post-filter / semantic ranker / metadata filtering

AI Precision and Recall Evaluation on Small Datasets

Learn how to effectively evaluate the precision and recall of AI models, especially when working with small question datasets. This guide covers the concepts, calculation methods, and practical considerations using scikit-learn.

ai / precision / recall / evaluation / small dataset / machine learning / scikit-learn / classification

Understanding Semantic Search: How it Works and Why Similar Text Might Not Answer Your Question

Explore the principles of semantic search, its reliance on embeddings, and the reasons why text that appears similar might not provide the desired answer. Learn about vector search, hybrid search, and their applications in information retrieval.

semantic search / vector search / embeddings / AI / information retrieval / natural language processing / hybrid search / Azure AI Search