File tree Expand file tree Collapse file tree 4 files changed +4
-38
lines changed Expand file tree Collapse file tree 4 files changed +4
-38
lines changed Original file line number Diff line number Diff line change 11name : Evaluate
22
33on :
4- workflow_dispatch :
54 issue_comment :
65 types : [created]
7- pull_request :
8- branches : [ main ]
9- push :
10- branches : [ main, test-eval ]
116
127# Set up permissions for deploying with secretless Azure federated credentials
138# https://learn.microsoft.com/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication
@@ -17,7 +12,7 @@ permissions:
1712
1813jobs :
1914 evaluate :
20- # if: github.event_name == 'workflow_dispatch' || contains(github.event.comment.body, '#evaluate')
15+ if : ${{ github.event.issue.pull_request && contains(github.event.comment.body, '#evaluate')
2116 runs-on : ubuntu-latest
2217 env :
2318 UV_SYSTEM_PYTHON : 1
@@ -136,8 +131,7 @@ jobs:
136131
137132 - name : Evaluate local RAG flow
138133 run : |
139- PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; /^refs\/pull/ { print $3 }')
140- python evals/evaluate.py --targeturl=http://127.0.0.1:8000/chat --numquestions=2 --resultsdir=results/pr$PR_NUMBER
134+ python evals/evaluate.py --targeturl=http://127.0.0.1:8000/chat --numquestions=2 --resultsdir=results/pr${{ github.event.issue.number }}
141135
142136 - name : Upload server logs as build artifact
143137 uses : actions/upload-artifact@v4
@@ -155,7 +149,7 @@ jobs:
155149 uses : actions/upload-artifact@v4
156150 with :
157151 name : eval_result
158- path : ./evals/results/pr$PR_NUMBER
152+ path : ./evals/results/pr${{ github.event.issue.number }}
159153
160154 - name : GitHub Summary Step
161155 if : ${{ success() }}
Original file line number Diff line number Diff line change @@ -84,18 +84,6 @@ async def search(
8484 else :
8585 raise ValueError ("Both query text and query vector are empty" )
8686
87- first_item = (await self .db_session .execute (select (Item ).order_by (Item .id ).limit (1 ))).scalars ().first ()
88- # Will it work?
89- (
90- await self .db_session .execute (
91- text (
92- f"SELECT id, { Item .__tablename__ } .embedding_ada002 <=> :embedding AS distance "
93- f"FROM { Item .__tablename__ } ORDER BY distance LIMIT 2"
94- ),
95- {"embedding" : first_item .embedding_ada002 },
96- )
97- ).fetchall ()
98-
9987 results = (
10088 await self .db_session .execute (
10189 sql ,
Original file line number Diff line number Diff line change @@ -3,4 +3,4 @@ You have access to an Azure PostgreSQL database with an items table that has col
33Generate a search query based on the conversation and the new question.
44If the question is not in English, translate the question to English before generating the search query.
55If you cannot generate a search query, return the original user question.
6- DO NOT return anything besides the query!
6+ DO NOT return anything besides the query.
Original file line number Diff line number Diff line change @@ -53,22 +53,6 @@ async def seed_data(engine):
5353 pass
5454
5555 logger .info (f"{ table_name } table seeded successfully." )
56- # Do a simple query with <=>
57- # Check cosine distance of every item with the first item
58- async with async_sessionmaker (engine , expire_on_commit = False )() as session :
59- first_item = (await session .execute (select (Item ).order_by (Item .id ).limit (1 ))).scalars ().first ()
60- result = (
61- await session .execute (
62- text (
63- f"SELECT id, { Item .__tablename__ } .embedding_ada002 <=> :embedding AS distance "
64- f"FROM { Item .__tablename__ } ORDER BY distance LIMIT 2"
65- ),
66- {"embedding" : first_item .embedding_ada002 },
67- )
68- ).fetchall ()
69- logger .info ("Test query: cosine distance of first two items with the first item:" )
70- for row in result :
71- logger .info (row )
7256
7357
7458async def main ():
You can’t perform that action at this time.
0 commit comments