You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/config/models.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,7 @@ This page contains information on selecting a model to use and options to supply
6
6
7
7
GraphRAG was built and tested using OpenAI models, so this is the default model set we support. This is not intended to be a limiter or statement of quality or fitness for your use case, only that it's the set we are most familiar with for prompting, tuning, and debugging.
8
8
9
-
GraphRAG also utilizes a language model wrapper library used by several projects within our team, called fnllm. fnllm provides two important functions for GraphRAG: rate limiting configuration to help us maximize throughput for large indexing jobs, and robust caching of API calls to minimize consumption on repeated indexes for testing, experimentation, or incremental ingest. fnllm uses the OpenAI Python SDK under the covers, so OpenAI-compliant endpoints are a base requirement out-of-the-box.
10
-
11
-
Starting with version 2.6.0, GraphRAG supports using [LiteLLM](https://docs.litellm.ai/) instead of fnllm for calling language models. LiteLLM provides support for 100+ models though it is important to note that when choosing a model it must support returning [structured outputs](https://openai.com/index/introducing-structured-outputs-in-the-api/) adhering to a [JSON schema](https://docs.litellm.ai/docs/completion/json_mode).
9
+
Starting with version 2.6.0, GraphRAG supports using [LiteLLM](https://docs.litellm.ai/) for calling language models. LiteLLM provides support for 100+ models though it is important to note that when choosing a model it must support returning [structured outputs](https://openai.com/index/introducing-structured-outputs-in-the-api/) adhering to a [JSON schema](https://docs.litellm.ai/docs/completion/json_mode).
12
10
13
11
Example using LiteLLm as the language model tool for GraphRAG:
14
12
@@ -54,13 +52,15 @@ Example config with asymmetric model use:
54
52
models:
55
53
extraction_chat_model:
56
54
api_key: ${GRAPHRAG_API_KEY}
57
-
type: openai_chat
55
+
type: chat
56
+
model_provider: openai
58
57
auth_type: api_key
59
58
model: gpt-4o
60
59
model_supports_json: true
61
60
query_chat_model:
62
61
api_key: ${GRAPHRAG_API_KEY}
63
-
type: openai_chat
62
+
type: chat
63
+
model_provider: openai
64
64
auth_type: api_key
65
65
model: o1
66
66
model_supports_json: true
@@ -98,7 +98,6 @@ Many users have used platforms such as [ollama](https://ollama.com/) and [LiteLL
98
98
As of GraphRAG 2.0.0, we support model injection through the use of a standard chat and embedding Protocol and an accompanying ModelFactory that you can use to register your model implementation. This is not supported with the CLI, so you'll need to use GraphRAG as a library.
99
99
100
100
- Our Protocol is [defined here](https://github.com/microsoft/graphrag/blob/main/graphrag/language_model/protocol/base.py)
101
-
- Our base implementation, which wraps fnllm, [is here](https://github.com/microsoft/graphrag/blob/main/graphrag/language_model/providers/fnllm/models.py)
102
101
- We have a simple mock implementation in our tests that you can [reference here](https://github.com/microsoft/graphrag/blob/main/tests/mock_provider.py)
103
102
104
103
Once you have a model implementation, you need to register it with our ModelFactory:
Copy file name to clipboardExpand all lines: docs/config/yaml.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,20 +28,22 @@ For example:
28
28
models:
29
29
default_chat_model:
30
30
api_key: ${GRAPHRAG_API_KEY}
31
-
type: openai_chat
31
+
type: chat
32
+
model_provider: openai
32
33
model: gpt-4.1
33
34
model_supports_json: true
34
35
default_embedding_model:
35
36
api_key: ${GRAPHRAG_API_KEY}
36
-
type: openai_embedding
37
+
type: embedding
38
+
model_provider: openai
37
39
model: text-embedding-3-large
38
40
```
39
41
40
42
#### Fields
41
43
42
44
- `api_key` **str** - The OpenAI API key to use.
43
45
- `auth_type`**api_key|azure_managed_identity** - Indicate how you want to authenticate requests.
44
-
- `type`**chat**|**embedding**|**openai_chat|azure_openai_chat|openai_embedding|azure_openai_embedding|mock_chat|mock_embeddings** - The type of LLM to use.
46
+
- `type`**chat**|**embedding**|mock_chat|mock_embeddings** - The type of LLM to use.
45
47
- `model_provider`**str|None** - The model provider to use, e.g., openai, azure, anthropic, etc. Required when `type == chat|embedding`. When `type == chat|embedding`, [LiteLLM](https://docs.litellm.ai/) is used under the hood which has support for calling 100+ models. [View LiteLLm basic usage](https://docs.litellm.ai/docs/#basic-usage) for details on how models are called (The `model_provider` is the portion prior to `/` while the `model` is the portion following the `/`). [View Language Model Selection](models.md) for more details and examples on using LiteLLM.
46
48
- `model`**str** - The model name.
47
49
- `encoding_model`**str** - The text encoding model to use. Default is to use the encoding model aligned with the language model (i.e., it is retrieved from tiktoken if unset).
Copy file name to clipboardExpand all lines: docs/get_started.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,12 +60,14 @@ If running in OpenAI mode, you only need to update the value of `GRAPHRAG_API_KE
60
60
In addition to setting your API key, Azure OpenAI users should set the variables below in the settings.yaml file. To find the appropriate sections, just search for the `models:` root configuration; you should see two sections, one for the default chat endpoint and one for the default embeddings endpoint. Here is an example of what to add to the chat model config:
61
61
62
62
```yaml
63
-
type: azure_openai_chat # Or azure_openai_embedding for embeddings
63
+
type: chat
64
+
model_provider: azure
64
65
api_base: https://<instance>.openai.azure.com
65
66
api_version: 2024-02-15-preview # You can customize this for other versions
66
-
deployment_name: <azure_model_deployment_name>
67
67
```
68
68
69
+
Most people tend to name their deployments the same as their model - if yours are different, add the `deployment_name` as well.
70
+
69
71
#### Using Managed Auth on Azure
70
72
To use managed auth, edit the auth_type in your model config and *remove* the api_key line:
msg=f"Model type {self.type} is not recognized, must be one of {ModelFactory.get_chat_models() +ModelFactory.get_embedding_models()}."
100
96
raiseKeyError(msg)
101
-
ifself.typein [
102
-
"openai_chat",
103
-
"openai_embedding",
104
-
"azure_openai_chat",
105
-
"azure_openai_embedding",
106
-
]:
107
-
msg=f"Model config based on fnllm is deprecated and will be removed in GraphRAG v3, please use {ModelType.Chat} or {ModelType.Embedding} instead to switch to LiteLLM config."
0 commit comments