INNER CODE UNIT · Python

context

eugeneyan/obsidian-copilot · src/app.py:176

    context = get_chunks_from_hits(os_hits + semantic_hits)
    return context


if __name__ == "__main__":
    logger.info(f'Environment variables loaded: {os.getenv("OPENAI_API_KEY")}')
    test_query = "Examples of bandits in industry"
    os_response = query_opensearch(test_query, os_client, INDEX_NAME)
    os_hits = parse_os_response(os_response)
    logger.debug(f"OS hits: {os_hits}")
    semantic_response = query_semantic(
        f"query: {test_query}", tokenizer, model, doc_embeddings_array
    )
    semantic_hits = parse_semantic_response(semantic_response, embedding_index)
    logger.debug(f"Semantic hits: {semantic_hits}")

    # Combine os and semantic hits and rank them
    context = get_chunks_from_hits(os_hits + semantic_hits)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…