Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Feature Request: Add async support for Generative AI Inference client

Abierto
#836 0 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python
Área
api, cloud

Línea de trabajo

Empieza revisando el PR #835 y el cliente síncrono existente de Generative AI Inference que usa requests. Compara el cliente async propuesto, sus 15 pruebas unitarias y 7 pruebas de integración con la compatibilidad solicitada para chat, streaming, embeddings, autenticación y context manager. Se considera terminado cuando las operaciones asíncronas solicitadas están cubiertas y las versiones de Python y los modelos indicados siguen siendo compatibles.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

SDK

Feature Request

Description

Add native async/await support for the OCI Generative AI Inference client to enable non-blocking concurrent requests in async applications.

Problem Statement

The current SDK uses synchronous HTTP requests via the requests library. This causes issues in async applications:

  1. Event loop blocking: Sync calls block the event loop in FastAPI, async agents, and other async frameworks
  2. Limited concurrency: Cannot efficiently make concurrent API calls
  3. Performance bottleneck: Sequential requests are significantly slower than concurrent alternatives
Proposed Solution

Add an AsyncGenerativeAiInferenceClient class that:

  • Uses aiohttp for true async HTTP requests
  • Reuses the existing OCI Signer for authentication
  • Provides async versions of all GenAI operations (chat, streaming, embeddings, etc.)
  • Supports async context manager pattern
Example Usage
import asyncio
from oci.generative_ai_inference import AsyncGenerativeAiInferenceClient

async def main():
    async with AsyncGenerativeAiInferenceClient(config) as client:
        # Concurrent requests - 3x faster than sequential
        results = await asyncio.gather(
            client.chat(details1),
            client.chat(details2),
            client.chat(details3),
        )

asyncio.run(main())
Performance Impact

Testing shows 2-3.5x throughput improvement for concurrent workloads:

Scenario Sequential Concurrent Speedup
3 requests (Llama 3.3) 1.30s 0.64s 2.01x
3 requests (Llama 3.2) 1.40s 0.44s 3.18x
3 requests (Cohere) 0.50s 0.14s 3.54x
Use Cases
  1. FastAPI/async web frameworks: Non-blocking GenAI calls in async endpoints
  2. LangChain agents: Concurrent tool calls and chain execution
  3. Batch processing: Parallel processing of multiple prompts
  4. Real-time applications: Low-latency streaming responses
Implementation

A reference implementation is provided in PR #835 with:

  • Full async client implementation
  • 15 unit tests
  • 7 integration tests
  • Tested on Python 3.9, 3.12, 3.13, 3.14
  • Tested with 6 different models
Related
  • PR: #835
Lenguaje dominante
Python
Estrellas
473
Forks
322
Merge medio
13 min
PR fusionados (30 d)
4

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de oracle/oci-python-sdk

Todos los issues de oracle/oci-python-sdk

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.