support a custom HTTPX client in `Client` and `AsyncClient`
As well as allowing a custom httpx client, this also improves type safety in Client and AsyncClient - previously self._client implicitly had type of None.
This is needed for pydantic-ai to use this library rather than the OpenAI compatibility layer, see https://github.com/pydantic/pydantic-ai/issues/242.
Thanks for the PR. Can you provide some details in the description of why this change is necessary for pydantic-ai?
We would like to reuse a set of http connections (encapsulated in an HTTPX client) when creating Ollama clients, so it's as cheap as possible to create new clients.
Please could you at least kick off tests.
By the way, you can set github to run tests automatically, even for new contributors; this change makes it much more attractive to contribute to the library.
Hi can you fix the tests? ollama-python currently targets 3.8 so the union types | are not supported. Please use typing.Union
Fixed suggestions I think, by the way it would be easier for contributors and less work for you if you let tests run automatically.
Friendly request to please take another peek at this PR. I’m here as a user of pydantic-ai and would love to be able to leverage ollama structured outputs and pydantic-ai for super powered local agents.😀
Really appreciate the hard work from both projects, so thank you all in advance!
Also, if you have a donation link of some kind, I’d be happy to use that to support.