-
Notifications
You must be signed in to change notification settings - Fork 61
201 ml streaming endpoint #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new streaming endpoint for chat-based interactions with a local large language model (LLM) and updates related dependencies, Docker compose settings, and documentation.
- Added a new asynchronous chat client test in tests/chat.py.
- Introduced a new LLM streaming service via app/services/llm.py and its corresponding API endpoint in app/api/ml.py, with integration updates in app/main.py and README.md.
- Upgraded project dependencies in pyproject.toml and adjusted Docker networking for app, db, and redis containers in compose.yml.
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tests/chat.py | Added a basic async chat client for testing the streaming endpoint. |
pyproject.toml | Updated project version and bumped several dependency versions. |
compose.yml | Configured host networking for containers. |
app/services/llm.py | Added a new LLM service for streaming chat responses. |
app/main.py | Introduced the new ml router and updated API version. |
app/api/ml.py | Created a StreamingResponse endpoint for LLM chat. |
README.md | Documented the new LLM integration and usage instructions. |
Files not reviewed (1)
- .env: Language not supported
Comments suppressed due to low confidence (1)
compose.yml:4
- Using host networking may reduce container isolation and could expose additional security risks. Please confirm that this configuration is intentional and acceptable for the deployment environment.
network_mode: host
except Exception: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid silently passing exceptions using a bare 'except Exception:' block. Consider logging the error details or handling the exception explicitly to aid in debugging.
except Exception: | |
pass | |
except Exception as e: | |
logging.exception("Error processing streamed line: %s", line) |
Copilot uses AI. Check for mistakes.
async with httpx.AsyncClient() as client: | ||
while True: | ||
# Get user input | ||
prompt = input("\nYou: ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the synchronous input() call inside an async function may block the event loop. Consider using an asynchronous input strategy or executing the blocking call in a separate thread to avoid potential performance issues.
prompt = input("\nYou: ") | |
prompt = await anyio.to_thread.run_sync(input, "\nYou: ") |
Copilot uses AI. Check for mistakes.
No description provided.