Skip to content

Instantly share code, notes, and snippets.

@vndee
Created March 29, 2025 09:56
Show Gist options
  • Save vndee/c60f75ce606e74629d375a2f7ace2ccb to your computer and use it in GitHub Desktop.
Save vndee/c60f75ce606e74629d375a2f7ace2ccb to your computer and use it in GitHub Desktop.
# Simplified pseudocode for ToG reasoning loop
for depth in range(max_depth):
# Explore the knowledge graph
related_entities = explore_connections(current_entities, query)
# Retrieve and evaluate contextual information
context_information = retrieve_contexts(related_entities)
# Evaluate whether we have sufficient information
if has_sufficient_information(context_information, query):
return generate_answer(context_information, query)
# Update exploration focus based on relevance
current_entities = prune_and_select(related_entities, context_information)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment