Skip to content

Commit

Permalink
correct and ignore linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tylertitsworth committed Jan 4, 2024
1 parent 841fc71 commit 6441c5a
Show file tree
Hide file tree
Showing 17 changed files with 59 additions and 43 deletions.
14 changes: 5 additions & 9 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +25,10 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
Expand Down
4 changes: 4 additions & 0 deletions .github/linters/.hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
ignored:
- DL3006
- DL3008
6 changes: 6 additions & 0 deletions .github/linters/.markdown-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
MD013: false
MD024: false
MD025: false
MD034: false
MD041: false
1 change: 1 addition & 0 deletions .github/linters/.python-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
disable=E1101, E501
1 change: 1 addition & 0 deletions .github/linters/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
4 changes: 3 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Lint

on: # yamllint disable-line rule:truthy
Expand All @@ -24,4 +25,5 @@ jobs:
env:
DEFAULT_BRANCH: main
# To report GitHub Actions status checks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTIONS_COMMAND_ARGS: '-ignore SC.*'
3 changes: 2 additions & 1 deletion .github/workflows/sync-space.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Sync Space
on:
push:
Expand All @@ -13,7 +14,7 @@ jobs:
fetch-depth: 0
- name: Login with Huggingface CLI
run: |
pip install -U "huggingface_hub[cli]" hf-transfer
pip install -U huggingface_hub[cli] hf-transfer
git config --global credential.helper store
huggingface-cli login --token ${{ secrets.HF_TOKEN }}
- name: Upload Files
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Unit Tests
on:
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ decisions when appropriate.

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ To ensure a smooth and effective contribution process, please follow these guide
### Making Changes

- Fork the repository and create a new branch for your changes.
- Keep each pull request focused on a single feature or bug fix.
- Keep each pull request focused on a single feature or bugfix.
- Write clear and descriptive commit messages.
- Keep code changes concise and well-documented.
- Ensure that your code adheres to the project's coding standards.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ within Kara-Tur.

#### Add Different Data to DB

Choose a new [Filetype Document Loader](https://python.langchain.com/docs/modules/data_connection/document_loaders/) or [App Document Loader](https://python.langchain.com/docs/integrations/document_loaders/) and include those files in your VectorDB.
Choose a new [File type Document Loader](https://python.langchain.com/docs/modules/data_connection/document_loaders/) or [App Document Loader](https://python.langchain.com/docs/integrations/document_loaders/) and include those files in your VectorDB.

```python
Document = namedtuple("Document", ["page_content", "metadata"])
Expand Down
1 change: 1 addition & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
data_dir: ./data
# Huggingface
embeddings_model: sentence-transformers/all-mpnet-base-v2
Expand Down
28 changes: 14 additions & 14 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
from sys import exit

import argparse
import chainlit as cl
import yaml
import torch

from collections import namedtuple
from chainlit.input_widget import Slider, TextInput
from chainlit.playground.config import add_llm_provider
Expand All @@ -12,13 +19,7 @@
from langchain.memory import ChatMessageHistory, ConversationBufferMemory
from langchain.vectorstores import Chroma
from provider import LangchainGenericProvider
from sys import exit

import argparse
import chainlit as cl
import yaml

import torch

if not torch.cuda.is_available():
torch.set_num_threads(torch.get_num_threads() * 2)
Expand Down Expand Up @@ -56,7 +57,7 @@ def set_chat_settings(self, settings):
setattr(wiki, key, val)


### Globals
# Globals
wiki = MultiWiki()


Expand Down Expand Up @@ -272,11 +273,10 @@ async def setup_agent(settings):

chain = create_chain()

if not wiki.question:
print("No Prompt for Chatbot found")
if wiki.question:
res = chain(wiki.question)
answer = res["answer"]
print(answer)
print([source_doc.page_content for source_doc in res["source_documents"]])
else:
exit(1)

res = chain(wiki.question)
answer = res["answer"]
print(answer)
print([source_doc.page_content for source_doc in res["source_documents"]])
3 changes: 2 additions & 1 deletion provider.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import List, Union

from chainlit.input_widget import InputWidget
from chainlit.playground.provider import BaseProvider
from chainlit.prompt import PromptMessage
from chainlit.sync import make_async
from fastapi.responses import StreamingResponse
from typing import List, Union


class LangchainGenericProvider(BaseProvider):
Expand Down
22 changes: 12 additions & 10 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
import pytest

optional_markers = {
"ollama": {"help": "Test ollama backend with Langchain",
"marker-descr": "Enable langchain tests with ollana",
"skip-reason": "Test only runs with the --{} option."},
"ollama": {
"help": "Test ollama backend with Langchain",
"marker-descr": "Enable langchain tests with ollana",
"skip-reason": "Test only runs with the --{} option.",
},
}


def pytest_addoption(parser):
for marker, info in optional_markers.items():
parser.addoption("--{}".format(marker), action="store_true",
default=False, help=info['help'])
parser.addoption(
"--{}".format(marker), action="store_true", default=False, help=info["help"]
)


def pytest_configure(config):
for marker, info in optional_markers.items():
config.addinivalue_line("markers",
"{}: {}".format(marker, info['marker-descr']))
config.addinivalue_line(
"markers", "{}: {}".format(marker, info["marker-descr"])
)


def pytest_collection_modifyitems(config, items):
for marker, info in optional_markers.items():
if not config.getoption("--{}".format(marker)):
skip_test = pytest.mark.skip(
reason=info['skip-reason'].format(marker)
)
skip_test = pytest.mark.skip(reason=info["skip-reason"].format(marker))
for item in items:
if marker in item.keywords:
item.add_marker(skip_test)
7 changes: 3 additions & 4 deletions test/test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from main import MultiWiki, create_chain

import argparse
import pytest

import torch
from main import MultiWiki, create_chain

torch.set_num_threads(22)

wiki = MultiWiki()
Expand Down Expand Up @@ -36,7 +35,7 @@ def test_multiwiki_set_args():
parser.add_argument("--no-embed", dest="embed", action="store_false")
wiki.set_args(parser.parse_args([]))
print(wiki.args)
assert wiki.args.embed == True
assert wiki.args.embed is True


@pytest.mark.ollama
Expand Down

0 comments on commit 6441c5a

Please sign in to comment.