-
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.
add: publissh feats, fix: charts, naming
- Loading branch information
1 parent
81a8653
commit 217fda1
Showing
14 changed files
with
2,861 additions
and
52 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,7 @@ | ||
## Context | ||
Bullet list of changes | ||
|
||
## Checklist | ||
- [ ] Self-Review | ||
- [ ] Added Tests for functionality | ||
- [ ] Did you need to update Readme? |
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,38 @@ | ||
name: run-unit-tests | ||
|
||
on: push | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-22.04 | ||
container: python:3.11-slim | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: 'Create env file' | ||
run: | | ||
touch .env | ||
echo OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} >> .env | ||
- name: Install dependencies | ||
run: | | ||
apt-get update && apt-get install -y curl build-essential | ||
- name: Install Poetry | ||
run: pip install poetry | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.11 | ||
cache: poetry | ||
|
||
- name: Install Python libraries | ||
run: poetry install | ||
|
||
- name: Run tests with coverage | ||
run: poetry run pytest --cache-clear -vv tests \ | ||
--cov=lamoom_cicd \ | ||
--cov-fail-under=80 \ | ||
--cov-report term-missing |
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 |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
__pycache__ | ||
*.py[cod] | ||
.pytest_cache | ||
.vscode | ||
.vscode | ||
dist |
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 |
---|---|---|
@@ -0,0 +1,160 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "4w_ZNZ46ddtF" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%pip install lamoom-cicd==0.1.4" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": { | ||
"id": "-5T7WYDOjrWD" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from lamoom_cicd import TestLLMResponsePipe" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "czcr362ntVl0" | ||
}, | ||
"source": [ | ||
"# Initialize your `ideal_answer`, `llm_response` and `optional_params`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": { | ||
"id": "Q_wAswxetVHx" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"ideal_answer = \"\"\"Blockchain is like a digital notebook that everyone can see\n", | ||
" but no one can secretly change. Imagine a shared Google Doc where every change\n", | ||
" is recorded forever, and no one can erase or edit past entries.\n", | ||
" Instead of one company controlling it, thousands of computers around\n", | ||
" the world keep copies, making it nearly impossible to hack or fake.\n", | ||
" This is why it’s used for things like Bitcoin—to keep transactions\n", | ||
" secure and transparent without needing a bank in the middle.\"\"\"\n", | ||
"\n", | ||
"llm_response = \"\"\"Blockchain is like a shared digital notebook where everyone has a copy.\n", | ||
"New records (blocks) are added in order and can’t be changed or erased.\n", | ||
"Each block is securely locked with a code, and everyone in the network must agree\n", | ||
"before adding new information. This makes blockchain transparent, secure, and\n", | ||
"tamper-proof, which is why it's used for things like cryptocurrency, secure transactions,\n", | ||
"and digital contracts.\"\"\"\n", | ||
"\n", | ||
"optional_params = {'prompt_id': \"blockchain_prompt\"}" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "WwOpSoELtkmr" | ||
}, | ||
"source": [ | ||
"# Initialize `TestLLMResponsePipe`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "D-PX2WGWtkQY" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Works with openai, azure, gemini, claude and nebibus keys\n", | ||
"lamoom_pipe = TestLLMResponsePipe(threshold=75, openai_key=\"your_key\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "wnFqAK5Ys8Cz" | ||
}, | ||
"source": [ | ||
"# 1. Manual Testing" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "b0EdE8A_jjos" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"result = lamoom_pipe.compare(ideal_answer, llm_response, optional_params=optional_params)\n", | ||
"\n", | ||
"print(result.score.to_dict())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "cspAD9xotFCM" | ||
}, | ||
"source": [ | ||
"# 2. Testing with CSV" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "E8W2tCSVtIqr" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"results = lamoom_pipe.compare_from_csv(\"your_csv_file_path\")\n", | ||
"for result in results:\n", | ||
" print(result.score.to_dict())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "D0qbJXRMt5EG" | ||
}, | ||
"source": [ | ||
"# 3. Visualize your test results" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "ycbh9-_iq5as" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"lamoom_pipe.visualize_test_results()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"colab": { | ||
"provenance": [] | ||
}, | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
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,3 +1,3 @@ | ||
from .test_llm_response import TestLLMResponse | ||
from .test_llm_response import TestLLMResponsePipe | ||
|
||
__all__ = ["TestLLMResponse"] | ||
__all__ = ["TestLLMResponsePipe"] |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.