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

Aperta
#14,746 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

.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.

Lingua principale
C#
Stelle
28.8k
Fork
4.9k
Merge medio
2g 17h
PR unite (30g)
48

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/semantic-kernel

Tutte le issue di microsoft/semantic-kernel

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.