Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Notebook examples for global/local/drift search are outdated since V2.0.0 is released. #1776

Open
3 tasks done
icejean opened this issue Feb 28, 2025 · 3 comments
Open
3 tasks done
Labels
backlog We've confirmed some action is needed on this and will plan it bug Something isn't working

Comments

@icejean
Copy link

icejean commented Feb 28, 2025

Do you need to file an issue?

  • I have searched the existing issues and this bug is not already filed.
  • My model is hosted on OpenAI or Azure. If not, please look at the "model providers" issue and don't file a new one here.
  • I believe this is a legitimate bug, not just a question. If this is a question, please use the Discussions area.

Describe the bug

The method to initialize a chat or embedding model is changed in V2.0.0, so the example notebooks can't run any longer. These lines will lead to exceptions:

from graphrag.query.llm.oai.chat_openai import ChatOpenAI
from graphrag.query.llm.oai.typing import OpenaiApiType

Waiting for updates. 8-)

Steps to reproduce

No response

Expected Behavior

No response

GraphRAG Config Used

# Paste your config here

Logs and screenshots

No response

Additional Information

  • GraphRAG Version:
  • Operating System:
  • Python Version:
  • Related Issues:
@icejean icejean added bug Something isn't working triage Default label assignment, indicates new issue needs reviewed by a maintainer labels Feb 28, 2025
@natoverse natoverse added backlog We've confirmed some action is needed on this and will plan it and removed triage Default label assignment, indicates new issue needs reviewed by a maintainer labels Mar 1, 2025
@nanda-rani
Copy link

nanda-rani commented Mar 1, 2025

I'm also facing the same issue. Any idea on how to change the package import??

@ricky-bug
Copy link

`from pathlib import Path
import asyncio

import pandas as pd
import graphrag.api as api
from graphrag.config.load_config import load_config
config = load_config(
root_dir=Path("."),
config_filepath=Path("settings.yaml")
)

INPUT_DIR = "./inputs"
LANCEDB_URI = f"./output/lancedb"

NODES_TABLE = "create_final_nodes"
COMMUNITY_REPORT_TABLE = "create_final_community_reports"
COMMUNITY_TABLE = "create_final_communities"
ENTITY_TABLE = "create_final_entities"
RELATIONSHIP_TABLE = "create_final_relationships"
COVARIATE_TABLE = "create_final_covariates"
TEXT_UNIT_TABLE = "create_final_text_units"
COMMUNITY_LEVEL = 2

read nodes table to get community and degree data

entity_df = pd.read_parquet(f"output/{ENTITY_TABLE}.parquet")
community_df = pd.read_parquet(f"output/{COMMUNITY_TABLE}.parquet")
nodes_df = pd.read_parquet(f"output/{NODES_TABLE}.parquet")
relationship_df = pd.read_parquet(f"output/{RELATIONSHIP_TABLE}.parquet")
text_unit_df = pd.read_parquet(f"output/{TEXT_UNIT_TABLE}.parquet")
covariates_df = pd.read_parquet(f"output/{COVARIATE_TABLE}.parquet")

community_report_df = pd.read_parquet(f"output/{COMMUNITY_REPORT_TABLE}.parquet")

query = "Your query can put here"
response, context_data = asyncio.run(
api.local_search(
config=config,
nodes=nodes_df,
entities=entity_df,
community_reports=community_report_df,
text_units=text_unit_df,
relationships=relationship_df,
covariates=covariates_df,
community_level=COMMUNITY_LEVEL,
response_type="Multiple Paragraphs",
query=query,
)
)
print(response)`

@ricky-bug
Copy link

You can check other search in "api" folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog We've confirmed some action is needed on this and will plan it bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants