New Feature: Python — provider-independent batch request API for model services (encode/create/status/cancel/collect)

Offen
#14,746 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 3 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
python

Rechercherichtung

Read the proposed batch API scope and compare the referenced pydantic-ai batch codec with Semantic Kernel’s Python connector structure; the issue does not name specific SK Python files. Start by discussing the API design with maintainers, as the contribution policy requires agreement before implementation. Done means an agreed design, then a provider implementation with tests for credential grouping, polling, errors, and large embedding batches.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

.NET python triage

Semantic Kernel currently invokes one AI service per call via service IDs, and large-input workloads are handled ad hoc inside connectors (e.g. the 100-input Gemini embedding chunking in PR #14700). Peer framework pydantic-ai provides a shared batch model: encode requests, group them by credential, create/status/cancel provider batch jobs, and report per-request results including unrun requests.

Proposal: add an opt-in batch request API for SK Python connectors (BatchRequest/Batch/result types plus batch_encode/create/status/cancel on a model-service interface), implemented first for one provider, so future connectors get consistent grouping, polling and error behavior. No public signatures change for existing non-batch paths; this needs design agreement before implementation per the contribution policy.

Users

SK users indexing document sets or running large offline evaluation/scoring workloads who today must chunk inputs and poll provider batch jobs themselves, per connector.

Expected Effect

A shared batch abstraction lets connectors (OpenAI, Azure OpenAI, Google, Anthropic) support provider batch endpoints with consistent grouping, polling and error semantics instead of ad-hoc per-connector chunking like PR #14700.

Scope

Python first (where connector activity is concentrated): a new batch module under semantic_kernel/connectors or services plus opt-in implementation on one connector (e.g. OpenAI chat or Google embeddings). .NET parity and additional providers stay out of scope until the design is agreed.

Validation

cd python && uv run pytest tests/unit/connectors -q plus new tests: encode produces provider payloads; create groups only same-credential requests; status polling stops at ended; unrun/canceled requests surface typed errors; >100-input embedding calls split like #14700. Expected: new tests fail on base, pass with change.

Risks

New public API surface in a compatibility-bound project; provider batch semantics differ (Google inline vs OpenAI file-based jobs), so a wrong abstraction could force breaking changes later.

Effort

Design discussion plus ~1-2 weeks: shared batch types and codec-equivalent helpers, one connector implementation, unit tests mirroring pydantic-ai's grouped/polling/error coverage.

Comparison

pydantic-ai implements this as provider-independent codecs shared by anthropic/_batch.py, _openai_batch.py and _google_batch.py with BatchJobError, group isolation by credential hash and byte-limit prechecks; SK has only ordered service selection (MultipleModelTests) and per-connector workarounds.

Maintainer direction requested before implementation.

AI-assisted contribution.

Vorherrschende Sprache
C#
Sterne
28.8k
Forks
4.9k
Ø Merge
2 T. 17 Std.
Gemergte PRs (30 T.)
48

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/semantic-kernel

Alle Issues in microsoft/semantic-kernel

Ähnliche Issues

Weitere Issues zu C#

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.