Python: [Bug]: OllamaEmbeddingClient drops numeric zero keep_alive
Los mantenedores suelen responder en 1 día
@eavanvalkenburg ya está trabajando en esto.
Desde el 1/10/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Description
OllamaEmbeddingClient.get_embeddings silently drops numeric keep_alive=0 and 0.0 from the request. Ollama accepts numeric zero as an explicit keep-alive duration; the framework's declared option type also accepts it.
The embedding adapter uses if keep_alive := opts.get("keep_alive"), so zero is treated as absent. The real Ollama SDK serializes zero correctly when called directly. String "0", negative durations and positive durations are forwarded by the framework.
Expected: explicitly supplied numeric zero reaches /api/embed, while an omitted setting remains omitted.
Observed: the framework sends only model and input for numeric zero.
Reproduction
import asyncio
import json
import httpx
from ollama import AsyncClient
from agent_framework_ollama import OllamaEmbeddingClient
async def main():
def respond(request):
print(json.loads(request.content))
return httpx.Response(200, json={"model": "test-model", "embeddings": [[0.1, 0.2]]})
sdk = AsyncClient(host="http://ollama.test", transport=httpx.MockTransport(respond))
async with sdk._client:
client = OllamaEmbeddingClient(model="test-model", client=sdk)
await client.get_embeddings(["hello"], options={"keep_alive": 0})
await sdk.embed(model="test-model", input=["hello"], keep_alive=0)
asyncio.run(main())
Output before the fix:
{'model': 'test-model', 'input': ['hello']}
{'model': 'test-model', 'input': ['hello'], 'keep_alive': 0.0}
Environment
Current main 7634356a1de0fd5de287544113c34d32afeeba83, Python 3.11.15, Ollama SDK 0.5.3. Reproduction uses the real SDK with a simulated HTTP transport and needs no model/server.
Proposed contribution
I have prepared a focused change to use an explicit is not None guard and add HTTP-boundary regression coverage for zero and existing duration/omission behavior. I would like to contribute this fix. It adds no API or dependency.
- Lenguaje dominante
- Python
- Estrellas
- 14.2k
- Forks
- 2.5k
- Merge medio
- 2 d 11 h
- PR fusionados (30 d)
- 407
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/agent-framework
-
Python: [Bug]: A non-positive MCP request timeout silently disables the timeoutPosiblemente ocupada @jpalvarezl la tomó hace 5 días. Abiertopython
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
microsoft/agent-framework#9313 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
.NET: Proposal: add an llms.txtAbierto.NET python triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
microsoft/agent-framework#9092 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Python: raw-data content mappings lose annotations and attachment metadataPosiblemente ocupada @moonbox3 la tomó hace 18 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/agent-framework#8632 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Python: Clarify when to use platformPosiblemente ocupada @eavanvalkenburg la tomó hace 18 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/agent-framework#8599 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
.NET compaction documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
microsoft/agent-framework#4629 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/agent-framework
Issues similares
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 68/100
FavioVazquez/showtime#101 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
rossant/awesome-math#199 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
nautechsystems/nautilus_trader#5365 ·
Los mantenedores suelen responder en 1 día
-
Examples say cnxAbiertodocumentation embedded
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día