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

Feat/cog serv endpoint #241

Merged
merged 25 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e02dccf
Updated to work with managed identities.
dorbaker May 13, 2024
4bc205a
Updated to work with both api keys and managed identity.
dorbaker May 14, 2024
0373572
Updated to pass storage_account_name config parameter.
dorbaker May 14, 2024
4bad8ea
Updated to take optional cognitive services endpoint config parameter
dorbaker May 14, 2024
312718d
make api_key optional
jgbradley1 May 15, 2024
04e8526
fix formatting
jgbradley1 May 15, 2024
4556f6d
Bug fixes.
dorbaker May 15, 2024
ae09336
set storage_account_name to None by default
jgbradley1 May 15, 2024
de5aae1
Merge branch 'feat/aad' of https://github.com/microsoft/graphrag into…
jgbradley1 May 15, 2024
0886bd2
ruff formatting fixes
jgbradley1 May 15, 2024
98995ad
fix issue with using connection strings
jgbradley1 May 15, 2024
98169b0
Switched from storage account name to storage account blob url.
dorbaker May 16, 2024
d42eb57
Updates for configuration of cognitives services endpoint.
dorbaker May 21, 2024
97571df
Add missing env vars for smoke tests (#233)
AlonsoGuevara May 16, 2024
637e6ca
Bump JamesIves/github-pages-deploy-action from 4.6.0 to 4.6.1 (#234)
dependabot[bot] May 20, 2024
eec7fdb
feature/add-azure-managed-identity (#231)
dorbaker May 20, 2024
4b4ea89
Bump textual from 0.58.1 to 0.62.0 (#238)
dependabot[bot] May 20, 2024
f61474a
Bump requests from 2.31.0 to 2.32.0 (#240)
dependabot[bot] May 21, 2024
87a5157
Upgrade Pyright (#239)
darthtrevino May 21, 2024
d328e38
Updates for cog services endpoint.
dorbaker May 21, 2024
c055858
Updated documentation.
dorbaker May 21, 2024
f0b58b4
Merge branch 'feat/cog-serv-endpoint' of github.com:microsoft/graphra…
dorbaker May 21, 2024
e29a9c3
Update load_llm.py
dorbaker May 22, 2024
e8734d5
Merge branch 'main' into feat/cog-serv-endpoint
dorbaker May 29, 2024
24b13ee
Updated with release and formatting chagnes.
dorbaker May 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .semversioner/next-release/minor-20240529191314161734.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "minor",
"description": "Add config parameter for cognitive services endpoint."
}
1 change: 1 addition & 0 deletions docsite/posts/config/json_yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ This is the base LLM configuration section. Other steps may override this config
* `api_version` **str** - The API version
* `organization` **str** - The client organization.
* `proxy` **str** - The proxy URL to use.
* `cognitive_services_endpoint` **str** - The url endpoint for cognitive services.
* `deployment_name` **str** - The deployment name to use (Azure).
* `model_supports_json` **bool** - Whether the model supports JSON-mode output.
* `tokens_per_minute` **int** - Set a leaky-bucket throttle on tokens-per-minute.
Expand Down
15 changes: 15 additions & 0 deletions graphrag/config/create_graphrag_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def hydrate_llm_params(
llm_type = LLMType(llm_type) if llm_type else base.type
api_key = reader.str(Fragment.api_key) or base.api_key
api_base = reader.str(Fragment.api_base) or base.api_base
cognitive_services_endpoint = (
reader.str(Fragment.cognitive_services_endpoint)
or base.cognitive_services_endpoint
)
deployment_name = (
reader.str(Fragment.deployment_name) or base.deployment_name
)
Expand Down Expand Up @@ -111,6 +115,7 @@ def hydrate_llm_params(
or base.model_supports_json,
request_timeout=reader.float(Fragment.request_timeout)
or base.request_timeout,
cognitive_services_endpoint=cognitive_services_endpoint,
deployment_name=deployment_name,
tokens_per_minute=reader.int("tokens_per_minute", Fragment.tpm)
or base.tokens_per_minute,
Expand All @@ -135,6 +140,10 @@ def hydrate_embeddings_params(
api_proxy = reader.str("proxy") or base.proxy
api_type = reader.str(Fragment.type) or defs.EMBEDDING_TYPE
api_type = LLMType(api_type) if api_type else defs.LLM_TYPE
cognitive_services_endpoint = (
reader.str(Fragment.cognitive_services_endpoint)
or base.cognitive_services_endpoint
)
deployment_name = reader.str(Fragment.deployment_name)

if api_key is None and not _is_azure(api_type):
Expand All @@ -159,6 +168,7 @@ def hydrate_embeddings_params(
model=reader.str(Fragment.model) or defs.EMBEDDING_MODEL,
request_timeout=reader.float(Fragment.request_timeout)
or defs.LLM_REQUEST_TIMEOUT,
cognitive_services_endpoint=cognitive_services_endpoint,
deployment_name=deployment_name,
tokens_per_minute=reader.int("tokens_per_minute", Fragment.tpm)
or defs.LLM_TOKENS_PER_MINUTE,
Expand Down Expand Up @@ -209,6 +219,9 @@ def hydrate_parallelization_params(
api_base = reader.str(Fragment.api_base) or fallback_oai_base
api_version = reader.str(Fragment.api_version) or fallback_oai_version
api_proxy = reader.str(Fragment.api_proxy) or fallback_oai_proxy
cognitive_services_endpoint = reader.str(
Fragment.cognitive_services_endpoint
)
deployment_name = reader.str(Fragment.deployment_name)

if api_key is None and not _is_azure(llm_type):
Expand All @@ -235,6 +248,7 @@ def hydrate_parallelization_params(
model_supports_json=reader.bool(Fragment.model_supports_json),
request_timeout=reader.float(Fragment.request_timeout)
or defs.LLM_REQUEST_TIMEOUT,
cognitive_services_endpoint=cognitive_services_endpoint,
deployment_name=deployment_name,
tokens_per_minute=reader.int(Fragment.tpm)
or defs.LLM_TOKENS_PER_MINUTE,
Expand Down Expand Up @@ -521,6 +535,7 @@ class Fragment(str, Enum):
api_organization = "API_ORGANIZATION"
api_proxy = "API_PROXY"
async_mode = "ASYNC_MODE"
cognitive_services_endpoint = "COGNITIVE_SERVICES_ENDPOINT"
concurrent_requests = "CONCURRENT_REQUESTS"
conn_string = "CONNECTION_STRING"
container_name = "CONTAINER_NAME"
Expand Down
1 change: 1 addition & 0 deletions graphrag/config/input_models/llm_parameters_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class LLMParametersInput(TypedDict):
api_version: NotRequired[str | None]
organization: NotRequired[str | None]
proxy: NotRequired[str | None]
cognitive_services_endpoint: NotRequired[str | None]
deployment_name: NotRequired[str | None]
model_supports_json: NotRequired[bool | str | None]
tokens_per_minute: NotRequired[int | str | None]
Expand Down
3 changes: 3 additions & 0 deletions graphrag/config/models/llm_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class LLMParameters(BaseModel):
proxy: str | None = Field(
description="The proxy to use for the LLM service.", default=None
)
cognitive_services_endpoint: str | None = Field(
description="The endpoint to reach cognitives services.", default=None
)
deployment_name: str | None = Field(
description="The deployment name to use for the LLM service.", default=None
)
Expand Down
1 change: 1 addition & 0 deletions graphrag/index/llm/load_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def _get_base_config(config: dict[str, Any]) -> dict[str, Any]:
"model_supports_json": config.get("model_supports_json"),
"concurrent_requests": config.get("concurrent_requests", 4),
"encoding_model": config.get("encoding_model", "cl100k_base"),
"cognitive_services_endpoint": config.get("cognitive_services_endpoint"),
}


Expand Down
Loading