graphrag icon indicating copy to clipboard operation
graphrag copied to clipboard

Expose http_client for httpx client customization with custom root certificates

Open jtruxon opened this issue 1 year ago • 0 comments

Description

Exposed http_client to the consumer, to allow httpx client customization in case of execution within a corporate environment with custom root certs.

Related Issues

N/A

Proposed Changes

  • Exposed http_client in the graphrag.query.llm.oai.chat_openai.ChatOpenAI module.

Detailed Changes

  • Added http_client and http_client_async parameters to the __init__ method in graphrag/query/llm/oai/base.py and graphrag/query/llm/oai/chat_openai.py.
  • Modified the _create_openai_client method in graphrag/query/llm/oai/base.py to utilize the http_client and http_client_async parameters for both synchronous and asynchronous clients.
  • Documentation Update: Added a new page docsite/posts/config/corporate_ssl.md detailing how to configure httpx clients with custom SSL certificates.

Checklist

  • [x] I have tested these changes locally.
  • [x] I have reviewed the code changes.
  • [x] I have updated the documentation (if necessary).
  • [x] I have added appropriate unit tests (if applicable).

Additional Notes

Using custom root certs is a fairly uncommon scenario, but this change is critical to allow secure communication under those conditions.

jtruxon avatar Jul 05 '24 21:07 jtruxon