Skip to content

Commit

Permalink
formating second attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
framsouza committed Oct 15, 2024
1 parent 08fd195 commit f149b9a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
42 changes: 22 additions & 20 deletions supporting-blog-content/github-assistant/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import textwrap
import argparse
import traceback
from httpx import ReadTimeout
from httpx import ReadTimeout

logging.basicConfig(stream=sys.stdout, level=logging.INFO)
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
Expand All @@ -24,33 +24,33 @@
description="Process documents and questions for evaluation."
)
parser.add_argument(
"--num_documents",
type=int,
default=None,
help="Number of documents to process (default: all)"
"--num_documents",
type=int,
default=None,
help="Number of documents to process (default: all)"
)
parser.add_argument(
"--skip_documents",
type=int,
default=0,
help="Number of documents to skip at the beginning (default: 0)"
"--skip_documents",
type=int,
default=0,
help="Number of documents to skip at the beginning (default: 0)"
)
parser.add_argument(
"--num_questions",
type=int,
default=None,
help="Number of questions to process (default: all)"
"--num_questions",
type=int,
default=None,
help="Number of questions to process (default: all)"
)
parser.add_argument(
"--skip_questions",
type=int,
default=0,
help="Number of questions to skip at the beginning (default: 0)"
"--skip_questions",
type=int,
default=0,
help="Number of questions to skip at the beginning (default: 0)"
)
parser.add_argument(
"--process_last_questions",
action="store_true",
help="Process last N questions instead of first N"
"--process_last_questions",
action="store_true",
help="Process last N questions instead of first N"
)
args = parser.parse_args()

Expand Down Expand Up @@ -117,6 +117,7 @@

vector_index = VectorStoreIndex.from_documents(documents)


def display_eval_df(
query: str,
response: Response,
Expand Down Expand Up @@ -170,6 +171,7 @@ def wrap_text(text, width=50):
)
)


query_engine = vector_index.as_query_engine(llm=llm)

total_questions = len(eval_questions_list)
Expand Down
2 changes: 2 additions & 0 deletions supporting-blog-content/github-assistant/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
embed_model = OpenAIEmbedding(model="text-embedding-3-large")
Settings.embed_model = embed_model


def run_query_sync():
query = input("Please enter your query: ")

Expand Down Expand Up @@ -43,6 +44,7 @@ def run_query_sync():
es_vector_store.close()
print("Elasticsearch connection closed.")


if __name__ == "__main__":
try:
result = run_query_sync()
Expand Down

0 comments on commit f149b9a

Please sign in to comment.