Skip to content

Commit

Permalink
Use JSON mode for custom llm
Browse files Browse the repository at this point in the history
  • Loading branch information
liukidar committed Nov 27, 2024
1 parent 3194f6e commit e1f4322
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/custom_llm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""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
Expand All @@ -19,7 +21,9 @@
example_queries="\n".join(QUERIES),
entity_types=ENTITY_TYPES,
config=GraphRAG.Config(
llm_service=OpenAILLMService(model="your-llm-model", base_url="llm.api.url.com", api_key="your-api-key"),
llm_service=OpenAILLMService(
model="your-llm-model", base_url="llm.api.url.com", api_key="your-api-key", mode=instructor.Mode.JSON
),
embedding_service=OpenAIEmbeddingService(
model="your-embedding-model",
base_url="emb.api.url.com",
Expand Down

0 comments on commit e1f4322

Please sign in to comment.