-
Notifications
You must be signed in to change notification settings - Fork 1
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
Setup FastAPI Intelligence Service #47
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4d12f86
Setup FastAPI Intelligence Service
milesha 9ce4b1a
Add project structure
milesha 4995121
Change naming
milesha 2ea0c6c
Merge branch 'develop' into feature/set-up-intelligence-service
FelixTJDietrich 960992f
Merge branch 'develop' into feature/set-up-intelligence-service
FelixTJDietrich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Intelligence Service | ||
|
||
This is a FastAPI service for interfacing with LangChain and other machine learning services. | ||
|
||
## Table of Contents | ||
|
||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Project Structure](#project-structure) | ||
- [Testing](#testing) | ||
|
||
## Installation | ||
|
||
To set up the project locally, follow these steps: | ||
|
||
1. **Install dependencies:** | ||
The project uses `poetry` for dependency management. Install the dependencies by running: | ||
```bash | ||
poetry install | ||
``` | ||
|
||
2. **Run the application:** | ||
You can start the FastAPI application with Uvicorn: | ||
```bash | ||
poetry run uvicorn src.main:app --reload | ||
``` | ||
|
||
## Usage | ||
|
||
After running the application, you can access the FastAPI API documentation at `http://127.0.0.1:8000/docs` or `http://127.0.0.1:8000/redoc`. | ||
|
||
## Project Structure | ||
|
||
The project is organized as follows: | ||
``` | ||
intelligence-service/ | ||
├── pyproject.toml | ||
├── README.md | ||
├── poetry.lock | ||
├── .pytest_cache/ | ||
├── tests/ | ||
│ ├── __init__.py | ||
│ └── test_hello.py | ||
├── src/ | ||
│ ├── config.py | ||
│ ├── main.py | ||
│ └── auth/ | ||
│ └── router.py | ||
└── ... | ||
``` | ||
## Testing | ||
|
||
The project includes a set of unit tests to ensure that the core functionalities work as expected. These tests are located in the `tests/` directory. | ||
|
||
### Running Tests | ||
|
||
To run all tests, use the following command: | ||
|
||
```bash | ||
poetry run pytest |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[tool.poetry] | ||
name = "intelligence-service" | ||
version = "0.1.0" | ||
description = "A FastAPI service for interfacing with large language models (LLMs) and providing intelligent text-based responses" | ||
authors = ["milenasrb <[email protected]>"] | ||
readme = "README.md" | ||
package-mode = false | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.12" | ||
fastapi = "^0.112.0" | ||
uvicorn = "^0.30.5" | ||
|
||
|
||
[tool.poetry.group.dev.dependencies] | ||
httpx = "^0.27.0" | ||
pytest = "^8.3.2" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from fastapi import APIRouter | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get("/", response_model=dict, summary="Hello World Endpoint") | ||
async def hello_world(): | ||
return {"message": "Hello, World!"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Settings: | ||
APP_NAME: str = "Intelligence Service" | ||
|
||
|
||
settings = Settings() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from fastapi import FastAPI | ||
|
||
from .auth.router import router | ||
from .config import settings | ||
|
||
app = FastAPI(title=settings.APP_NAME) | ||
|
||
app.include_router(router) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from fastapi.testclient import TestClient | ||
from src.main import app | ||
|
||
client = TestClient(app) | ||
|
||
|
||
def test_hello_world(): | ||
response = client.get("/") | ||
assert response.status_code == 200 | ||
assert response.json() == {"message": "Hello, World!"} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Me might want to improve this in the future so it is just
poetry run intelligence-service
or so