File tree 4 files changed +4
-38
lines changed
4 files changed +4
-38
lines changed Original file line number Diff line number Diff line change 1
1
name : Evaluate
2
2
3
3
on :
4
- workflow_dispatch :
5
4
issue_comment :
6
5
types : [created]
7
- pull_request :
8
- branches : [ main ]
9
- push :
10
- branches : [ main, test-eval ]
11
6
12
7
# Set up permissions for deploying with secretless Azure federated credentials
13
8
# 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:
17
12
18
13
jobs :
19
14
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')
21
16
runs-on : ubuntu-latest
22
17
env :
23
18
UV_SYSTEM_PYTHON : 1
@@ -136,8 +131,7 @@ jobs:
136
131
137
132
- name : Evaluate local RAG flow
138
133
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 }}
141
135
142
136
- name : Upload server logs as build artifact
143
137
uses : actions/upload-artifact@v4
@@ -155,7 +149,7 @@ jobs:
155
149
uses : actions/upload-artifact@v4
156
150
with :
157
151
name : eval_result
158
- path : ./evals/results/pr$PR_NUMBER
152
+ path : ./evals/results/pr${{ github.event.issue.number }}
159
153
160
154
- name : GitHub Summary Step
161
155
if : ${{ success() }}
Original file line number Diff line number Diff line change @@ -84,18 +84,6 @@ async def search(
84
84
else :
85
85
raise ValueError ("Both query text and query vector are empty" )
86
86
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
-
99
87
results = (
100
88
await self .db_session .execute (
101
89
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
3
3
Generate a search query based on the conversation and the new question.
4
4
If the question is not in English, translate the question to English before generating the search query.
5
5
If 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):
53
53
pass
54
54
55
55
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 )
72
56
73
57
74
58
async def main ():
You can’t perform that action at this time.
0 commit comments