diff --git a/.gitignore b/.gitignore index 644df79..5da8204 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ venv __pycache__ *.pyc -responses \ No newline at end of file +responses diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..42a4dd9 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,16 @@ +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.2 + hooks: + - id: ruff + args: [--fix] + - id: ruff-format + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: "v4.3.0" + hooks: + - id: check-merge-conflict + - id: debug-statements + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace diff --git a/LICENSE b/LICENSE index 2986da3..9b06cae 100644 --- a/LICENSE +++ b/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/README.md b/README.md index ccf2503..b42364d 100644 --- a/README.md +++ b/README.md @@ -115,4 +115,4 @@ Contributions to this project are welcome. Please ensure you follow the existing ## Licence -This project is licensed under the MIT Licence - see the [LICENCE](LICENCE) file for details. \ No newline at end of file +This project is licensed under the MIT Licence - see the [LICENCE](LICENCE) file for details. diff --git a/llm-debate/debater.py b/llm-debate/debater.py index 50a82c1..89cfcba 100644 --- a/llm-debate/debater.py +++ b/llm-debate/debater.py @@ -48,9 +48,7 @@ def respond_to(self, opponent_argument: str) -> str: response: str = self.llm_client.get_response(prompt, self.model) self.responses.append(response) - self.debate_history.append( - f"{self.position.capitalize()} response: {response}" - ) + self.debate_history.append(f"{self.position.capitalize()} response: {response}") return response def conclude(self) -> str: @@ -69,4 +67,4 @@ def conclude(self) -> str: self.debate_history.append( f"{self.position.capitalize()} conclusion: {response}" ) - return response \ No newline at end of file + return response diff --git a/llm-debate/llm_clients.py b/llm-debate/llm_clients.py index cf50921..9eeef9d 100644 --- a/llm-debate/llm_clients.py +++ b/llm-debate/llm_clients.py @@ -11,6 +11,7 @@ class LLMClient(ABC): def get_response(self, prompt: str, model: str) -> str: pass + class OpenAIClient(LLMClient): def __init__(self) -> None: self.api_key: Optional[str] = os.getenv("OPENAI_API_KEY") @@ -25,6 +26,7 @@ def get_response(self, prompt: str, model: str) -> str: ) return response.choices[0].message.content + class AnthropicClient(LLMClient): def __init__(self) -> None: self.api_key: Optional[str] = os.getenv("ANTHROPIC_API_KEY") @@ -40,10 +42,11 @@ def get_response(self, prompt: str, model: str) -> str: ) return response.content[0].text + def get_llm_client(llm_type: str) -> LLMClient: if llm_type == "openai": return OpenAIClient() elif llm_type == "anthropic": return AnthropicClient() else: - raise ValueError(f"Unsupported LLM type: {llm_type}") \ No newline at end of file + raise ValueError(f"Unsupported LLM type: {llm_type}") diff --git a/llm-debate/template.html b/llm-debate/template.html index 7047586..255953e 100644 --- a/llm-debate/template.html +++ b/llm-debate/template.html @@ -59,4 +59,4 @@