llamaIndex - ✅(Solved) Fix [Feature Request]: Add support for `http_client` and `async_http_client` constructor arguments for `NVIDIAEmbedding` [2 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
run-llama/llama_index#20945Fetched 2026-04-08 00:30:08
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Timeline (top)
cross-referenced ×2labeled ×2commented ×1mentioned ×1

Fix Action

Fixed

PR fix notes

PR #1: feat(embeddings-nvidia): add http client support

Description (problem / solution / changelog)

Title: feat(embeddings-nvidia): add custom http client support

This PR implements #20945 by adding http_client and async_http_client support to NVIDIAEmbedding, bringing it in line with OpenAIEmbedding.

  • What’s changed

    • NVIDIAEmbedding.__init__ now accepts two optional arguments:
      • http_client: Optional[httpx.Client]
      • async_http_client: Optional[httpx.AsyncClient]
    • These are stored on the instance and passed into the underlying OpenAI / AsyncOpenAI clients via the http_client kwarg.
    • When these arguments are omitted, behavior is unchanged and the OpenAI clients are constructed as before (backwards compatible).
  • Why

    • Allows NVIDIA embeddings to be used with custom HTTP settings (e.g. verify=False for self‑signed HTTPS, proxies, connection pooling), matching the flexibility already available in OpenAIEmbedding.
  • Testing

    • Added test_nvidia_embedding_custom_http_clients to verify that:
      • The provided httpx.Client / httpx.AsyncClient are stored on NVIDIAEmbedding.
      • The underlying OpenAI and AsyncOpenAI clients actually use those instances.

Changed files

  • llama-index-integrations/embeddings/llama-index-embeddings-nvidia/llama_index/embeddings/nvidia/base.py (modified, +27/-12)
  • llama-index-integrations/embeddings/llama-index-embeddings-nvidia/tests/test_embeddings_nvidia.py (modified, +20/-0)

PR #21046: feat(embeddings-nvidia): add http client support

Description (problem / solution / changelog)

Title: feat(embeddings-nvidia): add custom http client support

This PR implements #20945 by adding http_client and async_http_client support to NVIDIAEmbedding, bringing it in line with OpenAIEmbedding.

  • What’s changed

    • NVIDIAEmbedding.__init__ now accepts two optional arguments:
      • http_client: Optional[httpx.Client]
      • async_http_client: Optional[httpx.AsyncClient]
    • These are stored on the instance and passed into the underlying OpenAI / AsyncOpenAI clients via the http_client kwarg.
    • When these arguments are omitted, behavior is unchanged and the OpenAI clients are constructed as before (backwards compatible).
  • Why

    • Allows NVIDIA embeddings to be used with custom HTTP settings (e.g. verify=False for self‑signed HTTPS, proxies, connection pooling), matching the flexibility already available in OpenAIEmbedding.
  • Testing

    • Added test_nvidia_embedding_custom_http_clients to verify that:
      • The provided httpx.Client / httpx.AsyncClient are stored on NVIDIAEmbedding.
      • The underlying OpenAI and AsyncOpenAI clients actually use those instances.

Changed files

  • llama-index-integrations/embeddings/llama-index-embeddings-nvidia/llama_index/embeddings/nvidia/base.py (modified, +27/-12)
  • llama-index-integrations/embeddings/llama-index-embeddings-nvidia/tests/test_embeddings_nvidia.py (modified, +20/-0)

Code Example

import httpx

embedder = OpenAIEmbedding(..., http_client=httpx.Client(verify=False), async_http_client=httpx.AsyncClient(verify=False))
RAW_BUFFERClick to expand / collapse

Feature Description

Please add support for specifying http_client and async_http_client as optional constructor arguments for llama_index.embeddings.nvidia.NVIDIAEmbedding, similar to how they are available in the OpenAIEmbedding constructor.

Reason

This would allow for features such as disabling SSL verification when using a locally hosted LLM with a self-signed certificate.

Currently with OpenAIEmbedding I can do:

import httpx

embedder = OpenAIEmbedding(..., http_client=httpx.Client(verify=False), async_http_client=httpx.AsyncClient(verify=False))

Value of Feature

Allows for a locally hosted embedding model served over HTTPs with a self-signed certificate.

extent analysis

Problem Summary

Add optional http_client and async_http_client arguments to NVIDIAEmbedding constructor.

Root Cause Analysis

Missing optional arguments in NVIDIAEmbedding constructor.

Fix Plan

1. Update NVIDIAEmbedding class definition

from llama_index.embeddings.nvidia import NVIDIAEmbedding
from httpx import Client, AsyncClient

class NVIDIAEmbedding:
    def __init__(self, ..., http_client: Client = None, async_http_client: AsyncClient = None):
        ...

2. Update __init__ method to use optional arguments

def __init__(self, ..., http_client: Client = None, async_http_client: AsyncClient = None):
    if http_client:
        self.http_client = http_client
    else:
        self.http_client = Client()

    if async_http_client:
        self.async_http_client = async_http_client
    else:
        self.async_http_client = AsyncClient()

3. Example usage

import httpx

embedder = NVIDIAEmbedding(..., http_client=httpx.Client(verify=False), async_http_client=httpx.AsyncClient(verify=False))

Verification

  • Check if http_client and async_http_client are properly set in the NVIDIAEmbedding instance.
  • Verify that disabling SSL verification works as expected.

Extra Tips

  • Make sure to update the documentation to reflect the new optional arguments.
  • Consider adding a default value for http_client and async_http_client to avoid potential issues.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

llamaIndex - ✅(Solved) Fix [Feature Request]: Add support for `http_client` and `async_http_client` constructor arguments for `NVIDIAEmbedding` [2 pull requests, 2 comments, 2 participants]