File tree Expand file tree Collapse file tree 2 files changed +24
-20
lines changed
supporting-blog-content/github-assistant Expand file tree Collapse file tree 2 files changed +24
-20
lines changed Original file line number Diff line number Diff line change 1515import textwrap
1616import argparse
1717import traceback
18- from httpx import ReadTimeout
18+ from httpx import ReadTimeout
1919
2020logging .basicConfig (stream = sys .stdout , level = logging .INFO )
2121logging .getLogger ().addHandler (logging .StreamHandler (stream = sys .stdout ))
2424 description = "Process documents and questions for evaluation."
2525)
2626parser .add_argument (
27- "--num_documents" ,
28- type = int ,
29- default = None ,
30- help = "Number of documents to process (default: all)"
27+ "--num_documents" ,
28+ type = int ,
29+ default = None ,
30+ help = "Number of documents to process (default: all)"
3131)
3232parser .add_argument (
33- "--skip_documents" ,
34- type = int ,
35- default = 0 ,
36- help = "Number of documents to skip at the beginning (default: 0)"
33+ "--skip_documents" ,
34+ type = int ,
35+ default = 0 ,
36+ help = "Number of documents to skip at the beginning (default: 0)"
3737)
3838parser .add_argument (
39- "--num_questions" ,
40- type = int ,
41- default = None ,
42- help = "Number of questions to process (default: all)"
39+ "--num_questions" ,
40+ type = int ,
41+ default = None ,
42+ help = "Number of questions to process (default: all)"
4343)
4444parser .add_argument (
45- "--skip_questions" ,
46- type = int ,
47- default = 0 ,
48- help = "Number of questions to skip at the beginning (default: 0)"
45+ "--skip_questions" ,
46+ type = int ,
47+ default = 0 ,
48+ help = "Number of questions to skip at the beginning (default: 0)"
4949)
5050parser .add_argument (
51- "--process_last_questions" ,
52- action = "store_true" ,
53- help = "Process last N questions instead of first N"
51+ "--process_last_questions" ,
52+ action = "store_true" ,
53+ help = "Process last N questions instead of first N"
5454)
5555args = parser .parse_args ()
5656
117117
118118vector_index = VectorStoreIndex .from_documents (documents )
119119
120+
120121def display_eval_df (
121122 query : str ,
122123 response : Response ,
@@ -170,6 +171,7 @@ def wrap_text(text, width=50):
170171 )
171172 )
172173
174+
173175query_engine = vector_index .as_query_engine (llm = llm )
174176
175177total_questions = len (eval_questions_list )
Original file line number Diff line number Diff line change 88embed_model = OpenAIEmbedding (model = "text-embedding-3-large" )
99Settings .embed_model = embed_model
1010
11+
1112def run_query_sync ():
1213 query = input ("Please enter your query: " )
1314
@@ -43,6 +44,7 @@ def run_query_sync():
4344 es_vector_store .close ()
4445 print ("Elasticsearch connection closed." )
4546
47+
4648if __name__ == "__main__" :
4749 try :
4850 result = run_query_sync ()
You can’t perform that action at this time.
0 commit comments