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

Zhipu API issues #79

Open
3414391918 opened this issue Aug 1, 2024 · 2 comments
Open

Zhipu API issues #79

3414391918 opened this issue Aug 1, 2024 · 2 comments

Comments

@3414391918
Copy link

Does this project currently not support the model interface of the Zhipu AI platform

@xuhe2
Copy link

xuhe2 commented Aug 2, 2024

No
in the code, like this function, you can see that all the api_base need the suffix v1, but Zhipu AI use v4 as suffix, I want to make a PR for Zhipu AI platform

@xuhe2
Copy link

xuhe2 commented Aug 3, 2024

I change the url in project, but it only works part of the time

    # Initialize embedding model
    if llm_service_type == "openai_chat":
        # Initialize OpenAI client for embeddings
        openai_client = OpenAI(
            api_key=embeddings_api_key or "dummy_key",
            base_url=f"{embeddings_api_base}/v1"
        )
    elif llm_service_type == "zhipu_chat":
        # Initialize Zhipu client for embeddings
        openai_client = OpenAI(
            api_key=embeddings_api_key or "dummy_key",
            base_url=f"{embeddings_api_base}/v4"
        )

I make some code like this, and the code above can work
now, the log show that

15:25:52,743 graphrag.index.create_pipeline_config INFO Using LLM Config {
    "api_key": "*****",
    "type": "openai_chat",
    "model": "glm-4",
    "max_tokens": 8192,
    "temperature": 0.0,
    "top_p": 1.0,
    "n": 1,
    "request_timeout": 180.0,
    "api_base": "https://open.bigmodel.cn/api/paas/v4",
    "api_version": null,
    "organization": null,
    "proxy": null,
    "cognitive_services_endpoint": null,
    "deployment_name": null,
    "model_supports_json": true,
    "tokens_per_minute": 0,
    "requests_per_minute": 0,
    "max_retries": 3,
    "max_retry_wait": 10.0,
    "sleep_on_rate_limit_recommendation": true,
    "concurrent_requests": 25
}

the url has been changed in this place, but it also has

2024-08-03 15:25:54,254 - api - INFO - None
2024-08-03 15:25:54,267 - api - INFO - ⠋ GraphRAG Indexer
2024-08-03 15:25:54,267 - api - INFO - ├── Loading Input (InputFileType.text) - 1 files loaded (0 filtered) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00 0:00:00
2024-08-03 15:25:54,267 - api - INFO - ├── create_base_text_units
2024-08-03 15:25:54,267 - api - INFO - ├── create_base_extracted_entities
2024-08-03 15:25:54,267 - api - INFO - ├── create_summarized_entities
2024-08-03 15:25:54,268 - api - INFO - └── create_base_entity_graph❌ Errors occurred during the pipeline run, see logs for more details.
2024-08-03 15:25:54,517 - watchfiles.main - INFO - 2 changes detected
2024-08-03 15:25:55,119 - api - ERROR - Indexing failed

the details for the error is

15:25:53,762 httpx INFO HTTP Request: POST https://open.bigmodel.cn/api/paas/v1/chat/completions "HTTP/1.1 404 Not Found"
15:25:53,762 httpcore.http11 DEBUG receive_response_body.started request=<Request [b'POST']>
15:25:53,763 httpcore.http11 DEBUG receive_response_body.complete
15:25:53,763 httpcore.http11 DEBUG response_closed.started
15:25:53,763 httpcore.http11 DEBUG response_closed.complete
15:25:53,763 openai._base_client DEBUG HTTP Request: POST https://open.bigmodel.cn/api/paas/v1/chat/completions "404 Not Found"
15:25:53,763 openai._base_client DEBUG Encountered httpx.HTTPStatusError
Traceback (most recent call last):
  File "/home/xuhe/miniconda3/envs/graphrag-local/lib/python3.11/site-packages/openai/_base_client.py", line 1599, in _request
    response.raise_for_status()
  File "/home/xuhe/miniconda3/envs/graphrag-local/lib/python3.11/site-packages/httpx/_models.py", line 761, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://open.bigmodel.cn/api/paas/v1/chat/completions'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404

I guess this is because of openai package(but the Zhipu docs show it can use openai SDK), I don't know how to solve it :(

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