bitflicker64 opened a new pull request, #367:
URL: https://github.com/apache/hugegraph-ai/pull/367
## Summary
`ollama.py` was using the abandoned `retry` PyPI package (last maintained
2016)
while `openai.py` and `litellm.py` in the same directory already use
`tenacity`.
This PR brings `ollama.py` in line with the established patterns.
## Changes
### `hugegraph-llm/src/hugegraph_llm/models/llms/ollama.py`
- Replace `from retry import retry` with `tenacity` imports
- Replace `@retry(tries=3, delay=1)` with `stop_after_attempt(3)`,
`wait_exponential(min=4, max=10)`, and
`retry_if_exception_type((ollama.ResponseError, httpx.ConnectError,
httpx.TimeoutException))`
— matching the pattern in `openai.py`
- Narrow `except Exception` to the specific retriable exception types
- Replace `print(f"Retrying LLM call {e}")` with `log.error(...)`
(consistent
with `openai.py`; `log` was already imported and used in the same file)
- Fix misleading "Retrying LLM call" message in `agenerate_streaming`,
which has no `@retry` decorator
- Replace `"""Comment"""` placeholder docstrings with real descriptions
### `hugegraph-llm/pyproject.toml`
- Remove `"retry"`, add `"tenacity"` as an explicit dependency
### `pyproject.toml`
- Replace `"retry~=0.9.2"` constraint with `"tenacity~=8.5.0"`
Closes #365
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]