-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from crux-bphc/linting
Linting
- Loading branch information
Showing
9 changed files
with
222 additions
and
26 deletions.
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,42 @@ | ||
name: Lint code and check formatting with black and isort | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Cache pip dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Cache pre-commit dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pre-commit- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pre-commit | ||
- name: Run pre-commit | ||
run: | | ||
pre-commit run --all-files |
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,18 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
|
||
- repo: https://github.com/pre-commit/mirrors-isort | ||
rev: v5.10.1 | ||
hooks: | ||
- id: isort | ||
args: ["--profile=black"] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 24.10.0 | ||
hooks: | ||
- id: black | ||
args: ["--config=pyproject.toml"] |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from src.app import BitsGPT | ||
|
||
bitsgpt = BitsGPT() | ||
app = bitsgpt.app | ||
app = bitsgpt.app |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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
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 |
---|---|---|
@@ -1,26 +1,33 @@ | ||
from langchain_core.messages import AIMessage | ||
|
||
from .agents import Agents | ||
from .state import State | ||
|
||
agents = Agents() | ||
|
||
|
||
def intent_classifier(state: State): | ||
query = state["messages"][0].content | ||
result = agents.intent_classifier(query, state.get("chat_history", "")) | ||
|
||
return {"messages": [result]} | ||
|
||
|
||
def course_query(state: State): | ||
query = state["messages"][0].content | ||
result = AIMessage("Course query not implemented yet") | ||
return {"messages": [result]} | ||
|
||
|
||
def general_campus_query(state: State): | ||
query = state["messages"][0].content | ||
result = agents.general_campus_query(query, state.get("chat_history", "")) | ||
return {"messages": [result]} | ||
|
||
|
||
def not_related_query(state: State): | ||
query = state["messages"][0].content | ||
result = AIMessage("I'm sorry, I don't understand the question, if it relates to campus please rephrase.") | ||
return {"messages": [result]} | ||
result = AIMessage( | ||
"I'm sorry, I don't understand the question, if it relates to campus please rephrase." | ||
) | ||
return {"messages": [result]} |
Oops, something went wrong.