Update calendar_rag.py
Browse files- calendar_rag.py +50 -50
calendar_rag.py
CHANGED
@@ -968,56 +968,56 @@ class AcademicCalendarRAG:
|
|
968 |
"query_info": {}
|
969 |
}
|
970 |
|
971 |
-
def main():
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
|
1016 |
-
|
1017 |
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
|
1022 |
-
if __name__ == "__main__":
|
1023 |
-
|
|
|
968 |
"query_info": {}
|
969 |
}
|
970 |
|
971 |
+
# def main():
|
972 |
+
# """Main function for processing real calendar queries"""
|
973 |
+
# try:
|
974 |
+
# # Load API key
|
975 |
+
# with open("key.txt", "r") as f:
|
976 |
+
# openai_api_key = f.read().strip()
|
977 |
+
|
978 |
+
# # Use create_default_config instead of direct PipelineConfig initialization
|
979 |
+
# config = create_default_config(openai_api_key)
|
980 |
+
|
981 |
+
# # Customize config for Thai academic calendar use case
|
982 |
+
# config.localization.enable_thai_normalization = True
|
983 |
+
# config.retriever.top_k = 5 # Adjust based on your needs
|
984 |
+
# config.model.temperature = 0.3 # Lower temperature for more focused responses
|
985 |
+
|
986 |
+
# # Initialize pipeline with enhanced config
|
987 |
+
# pipeline = AcademicCalendarRAG(config)
|
988 |
+
|
989 |
+
# # Load calendar data
|
990 |
+
# with open("calendar.json", "r", encoding="utf-8") as f:
|
991 |
+
# calendar_data = json.load(f)
|
992 |
+
# pipeline.load_data(calendar_data)
|
993 |
+
|
994 |
+
# # Real queries to process
|
995 |
+
# queries = input in web
|
996 |
+
|
997 |
+
# print("Processing calendar queries...")
|
998 |
+
# print("=" * 80)
|
999 |
+
|
1000 |
+
# for query in queries:
|
1001 |
+
# result = pipeline.process_query(query)
|
1002 |
+
# print(f"\nQuery: {query}")
|
1003 |
+
# print(f"Answer: {result['answer']}")
|
1004 |
+
|
1005 |
+
# # # Print retrieved documents for verification
|
1006 |
+
# # print("\nRetrieved Documents:")
|
1007 |
+
# # for i, doc in enumerate(result['documents'], 1):
|
1008 |
+
# # print(f"\nDocument {i}:")
|
1009 |
+
# # print(doc.content)
|
1010 |
+
|
1011 |
+
# # # Print query understanding info
|
1012 |
+
# # print("\nQuery Understanding:")
|
1013 |
+
# # for key, value in result['query_info'].items():
|
1014 |
+
# # print(f"{key}: {value}")
|
1015 |
|
1016 |
+
# print("=" * 80)
|
1017 |
|
1018 |
+
# except Exception as e:
|
1019 |
+
# logger.error(f"Pipeline execution failed: {str(e)}")
|
1020 |
+
# raise
|
1021 |
|
1022 |
+
# if __name__ == "__main__":
|
1023 |
+
# main()
|