Skip to content

itsDurvank/Generative-engine-optimization

Repository files navigation

Factors to calculate Visibility Score

  1. Ranking position of the product

  2. Frequency of the product

  3. Sentiment analysis of description

  4. Subquery generation for queries

  5. Authority Score (from SerpApi)

API Keys Required

Add these to your .env file:

OPENAI_API_KEY= GEMINI_API_KEY= OPENROUTER_API_KEY= Used Model : https://openrouter.ai/nvidia/nemotron-nano-12b-v2-vl:free SERPAPI_API_KEY= OPENPAGERANK_API_KEY= https://www.domcop.com/openpagerank/auth/signup

You can copy the placeholders from .env.example.

App.py

This is basically having 3 llm where a user gives query or multiple queries and then those 3 llm makes 4 subqueries each in unified list and then we attempt 3 times on each query and subquery across those 3 llms

Output file : llm_responses.json

process_responses.py

This process those responses in the "llm_responses.json" and generates

Output file : rank_normalized_summary.csv

Source_authority

This generates authority scores for websites mentioned across the web using the SERPAPI_API_KEY.

rf_calc.py

Calculates the rank frequency score by normalizing it in

outputfile : rank_frequency_summary.csv

extract_specific_brand_queries.py

It basically Can extract a specific brand from the "llm_responses.json"

sentiments.py

It can generate sentiments for llm response made for giving sentimental analaysis for file "extract_specific_brand_queries.py"

output file : Notion_sentiment_results.json

Sentiment_all_brand.

This calculates sentimental analysis and there avg for each brand, avg is affected by sample size more "positive sample" dominates the case

output file : brand_sentiment_analysis.json

metrics.py

Combines output from "rank_frequency_summary.csv" and "brand_sentiment_analysis.json" and authorative score from "source_authority.py" and calculates visbility score using this by formula

        merged["visibility_score"] = 100 * (
            (w1 * merged["rank_freq_score_norm"]) +
            (w2 * merged["sentiment_norm"]) +
            (w3 * merged["authority_norm"])
        ) * merged["freq_ratio"]

            # weights
            w1, w2, w3 = 0.5, 0.3, 0.2
            # w1 is for RF value
            # w2 is for Sentiment value
            # w3 is for Authority value

About

Seo but for modern llms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages