The prettify module provides utilities to format execution information from ScrapeGraphAI graphs into human-readable tables.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ScrapeGraphAI/Scrapegraph-ai/llms.txt
Use this file to discover all available pages before exploring further.
Functions
prettify_exec_info
The execution information containing node statistics. Each dictionary should contain:
node_name: Name of the graph nodetotal_tokens: Total tokens usedprompt_tokens: Tokens used in promptscompletion_tokens: Tokens used in completionssuccessful_requests: Number of successful API requeststotal_cost_USD: Total cost in USDexec_time: Execution time in seconds
If True, returns a formatted string table. If False, returns the original list of dictionaries.
A formatted string table if
as_string=True, otherwise the original list of dictionaries.Usage Example
Example Output
Whenas_string=True, the function returns a formatted table:
Accessing Raw Data
Integration with Logging
Understanding the Output
The formatted table includes the following columns:- Node: The name of the graph node (e.g., FetchNode, ParseNode, RAGNode)
- Tokens: Total tokens used by the node
- Prompt: Number of tokens in the prompt sent to the LLM
- Compl.: Number of tokens in the completion from the LLM
- Requests: Number of successful API requests made by the node
- Cost ($): Total cost in USD for the node’s operations
- Time (s): Execution time in seconds for the node
- Monitoring API usage and costs
- Identifying performance bottlenecks
- Optimizing prompt efficiency
- Tracking resource consumption across different nodes
