mjolnir-strike opened a new issue, #1440:
URL: https://github.com/apache/flink-agents/issues/1440

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   `OllamaChatModelConnection`, `OllamaEmbeddingModelConnection`, 
`DashScopeChatModelConnection` and `DashScopeEmbeddingModelConnection` declare 
`request_timeout: float | None` in `__init__`, but the pydantic field is 
`request_timeout: float` and has no `mode="before"` validator. So passing 
`None`, which the signature allows, fails validation instead of falling back to 
the default.
   
   `OpenAIEmbeddingModelConnection` already handles this with 
`@field_validator("request_timeout", mode="before")`, which maps `None` to the 
default.
   
   I found this while looking at the built-in resource timeouts for #1411.
   
   ### How to reproduce
   
   ```python
   from flink_agents.integrations.chat_models.ollama_chat_model import 
OllamaChatModelConnection
   
   OllamaChatModelConnection(name="ollama", request_timeout=None)
   # pydantic.ValidationError: request_timeout - Input should be a valid number
   ```
   
   The DashScope chat and embedding connections and the Ollama embedding 
connection behave the same way.
   
   ### Version and environment
   
   `main` at 0a646ef5, Python 3.12, pydantic 2.12.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!
   
   I'd follow the `OpenAIEmbeddingModelConnection` approach (a `mode="before"` 
validator that maps `None` to the default) and add unit tests for the four 
connections. Alternatively, I can drop `| None` from the signatures if you'd 
prefer `None` not to be accepted at all.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to