Skip to content

feat: Add Copilot chat and embeddings via LiteLLM - #2634

Merged
Chris Trevino (darthtrevino) merged 6 commits into
mainfrom
copilot-chat-embeddings
Nov 30, 2026
Merged

Chris Trevino (darthtrevino) merged 6 commits into
mainfrom
copilot-chat-embeddings

Conversation

@darthtrevino

Copy link
Copy Markdown
Member

Description

Allow LiteLLM completion and embedding providers to own authentication explicitly
through auth_method: provider. This supports providers such as LiteLLM's
github_copilot without requiring a GraphRAG-configured API key or a separate
SDK completion provider.

Requests continue through GraphRAG -> LiteLLM -> the provider API. LiteLLM owns
login, credential caching, refresh, and transport; GraphRAG does not copy or
manage provider tokens. Existing API-key and Azure-managed-identity modes remain.

Related Issues

Related earlier approach: #2616 (closed). This same-repository contribution
supersedes the separate Copilot SDK provider proposal with provider-managed
authentication in the existing LiteLLM completion and embedding integrations.
It is a different implementation, not a relocation of the SDK patch.

Proposed Changes

  • Add AuthMethod.Provider and configuration validation. Omit GraphRAG's
    api_key argument in both synchronous and asynchronous completion/embedding
    requests when this mode is selected.
  • Reject explicitly configured keys (including empty strings), credential
    overrides, and authentication headers in provider mode at configuration and
    request boundaries, while retaining non-authentication headers and arguments.
  • Preserve request/token usage when pricing metadata is absent or incomplete.
    Log a warning and omit unavailable cost metrics rather than reporting zero.
  • Normalize an embedding response whose model identifier is absent or null to
    the model sent in the request, preserving any returned model identifier.
  • Document chat and embedding configuration, LiteLLM's interactive Copilot
    device login, and generated-settings changes needed to remove API-key
    placeholders. Add a minor release note and focused regression tests.
  • Restore the working directory after the provider configuration test so other
    tests do not inherit its temporary directory.

Checklist

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

Additional Notes

Validation

Validation below applies to branch head
2387a929f46f5fc0e2f77c36e78e3cbd1449a250, not the original SDK provider.

  • uv run --no-sync pytest tests\unit\language_model\test_provider_auth.py tests\unit\language_model\test_provider_costs.py tests\unit\config -q
    -- passed locally: 87 tests.
  • uv run --no-sync poe check -- passed locally: 679 files formatted,
    Ruff clean, Pyright 0 errors/0 warnings.
  • Existing unit-test CI:
    uv run poe test_unit -- passed (Linux: 438 passed, 1 skipped);
    uv run poe test_verbs -- passed (Linux: 15 passed).
    The workflow succeeded on Linux and Windows.
  • Existing build/type-check CI:
    uv run poe check and uv build --all-packages -- passed across
    Python 3.11/3.13 on Linux and Windows.
  • Existing integration-test CI,
    spellcheck,
    and semver checks -- passed.
  • Existing notebook CI
    and smoke CI
    -- failed. Linux logs show 11 failed/1 passed notebooks and 2 failed
    smoke cases, rejecting missing Azure api_base before inference. These are
    Azure test configurations, not evidence of live Copilot provider compatibility.
    Creating a same-repository PR does not itself establish that these checks pass;
    results from its newly triggered runs must be evaluated separately.
  • No live Copilot chat/embedding calls or end-to-end GraphRAG evaluation were
    performed as part of this PR preparation. Mocked regressions and existing CI
    are not a live model/endpoint compatibility guarantee.

Authentication and provider limitations

  • Configure type: litellm, model_provider: github_copilot, and
    auth_method: provider for the relevant completion and embedding models.
    Remove api_key entirely, including generated ${GRAPHRAG_API_KEY} entries.
  • Initial LiteLLM device login can be interactive and is separate from GitHub
    Copilot CLI login. Provision the provider's authentication before unattended
    execution. Provider mode does not imply every LiteLLM provider supports
    keyless authentication, nor does it disable environment variables or
    credential stores used internally by LiteLLM.
  • Model availability, embedding dimensions, streaming, structured-output
    support, and generation capabilities remain dependent on the selected
    LiteLLM provider/model and workflow requirements. This patch does not add
    native SDK schema enforcement, a new JSON-output contract, or the original
    SDK adapter's runtime/session behavior.
  • Token usage is retained when pricing is unknown; missing cost metrics are not
    a zero-cost or Copilot subscription-billing estimate.

@darthtrevino Chris Trevino (darthtrevino) changed the title Support provider-managed authentication for LiteLLM chat and embeddings feat: Add Copilot chat and embeddings via LiteLLM Nov 19, 2026
Preserve upstream LiteLLM response typing and provider embedding-model normalization.

Co-authored-by: Copilot App <[email protected]>
@darthtrevino
Chris Trevino (darthtrevino) merged commit ad2c4f3 into main Nov 30, 2026
15 of 20 checks passed
@darthtrevino
Chris Trevino (darthtrevino) deleted the copilot-chat-embeddings branch November 30, 2026 21:52
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

Successfully merging this pull request may close these issues.

3 participants