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

Query Bug #69

Open
Dormiveglia-elf opened this issue Jan 17, 2025 · 1 comment
Open

Query Bug #69

Dormiveglia-elf opened this issue Jan 17, 2025 · 1 comment

Comments

@Dormiveglia-elf
Copy link

^CTraceback (most recent call last):
  File "/fast-graphrag/examples/custom_llm.py", line 50, in <module>
    print(grag.query("How does Java work?").response)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/fast-graphrag/fast_graphrag/_graphrag.py", line 157, in query
    return get_event_loop().run_until_complete(_query())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/miniconda3/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/miniconda3/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/miniconda3/lib/python3.12/asyncio/base_events.py", line 1949, in _run_once
    event_list = self._selector.select(timeout)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/miniconda3/lib/python3.12/selectors.py", line 468, in select
    fd_event_list = self._selector.poll(timeout, max_ev)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I am confused why I got this error since it execute well in other working directory. Below is my code:

"""Example usage of GraphRAG with custom LLM and Embedding services compatible with the OpenAI API."""

from typing import List

import instructor
from dotenv import load_dotenv

from fast_graphrag import GraphRAG
from fast_graphrag._llm import OpenAIEmbeddingService, OpenAILLMService

load_dotenv()

DOMAIN = ""
QUERIES: List[str] = [
    "How does Java work?",
]
ENTITY_TYPES: List[str] = ["organization","person","geo","event"]

working_dir = "./project/cs"
grag = GraphRAG(
    working_dir=working_dir,
    domain=DOMAIN,
    example_queries="\n".join(QUERIES),
    entity_types=ENTITY_TYPES,
    config=GraphRAG.Config(
        llm_service=OpenAILLMService(
            model="deepseek-chat",
            base_url="https://api.deepseek.com",
            api_key="",
            mode=instructor.Mode.JSON,
            # api_version="your-llm-api_version",
            client="openai"
        ),
        embedding_service=OpenAIEmbeddingService(
            model="text-embedding-3-small",
            base_url="https://api.openai.com/v1",
            api_key="",
            embedding_dim=1536,  # the output embedding dim of the chosen model
            # api_version="your-llm-api_version",
            client="openai"
        ),
    ),
)

# with open("guide_to_java.txt") as f:
#     grag.insert(f.read())

print(grag.query("How does Java work?").response)
@liukidar
Copy link
Contributor

Hello, is that the full error traceback? It looks like some python environment error. Are you perhaps running it from a Jupyter notebook or similar?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants