Add question caching
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 20/100
Hướng nghiên cứu
Bắt đầu với flow chat_completion được đề xuất và lần theo request path RAG hiện có, bao gồm việc tạo embedding, tìm kiếm vector, lịch sử chat và tạo completion. Xác định cách lưu trữ cache, hành vi đối sánh và giá trị trả về khi cache hit trước khi triển khai; done phải bao gồm cache hit và cache miss hoạt động được, cùng với các test cho cả hai path.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
Add a question caching feature. Pseudocode based on other repo-
def chat_completion(user_input):
# Generate embeddings from the user input
user_embeddings = generate_embeddings(openai_client, user_input)
# Query the chat history cache first to see if this question has been asked before
cache_results = cache_search(vectors=user_embeddings , num_results=1)
if len(cache_results) > 0:
return cache_results[0]['completion'], True
else:
# Perform vector search
search_results = get_similar_docs(openai_client, dbsource, user_input, 3)
print("Getting Chat History\n")
# Chat history
chat_history = get_chat_history(1)
# Generate the completion
print("Generating completions \n")
completions_results = generatecompletionede(user_input, search_results, chat_history)
# Cache the response
cacheresponse(user_input, user_embeddings, completions_results)
print("\n")
# Return the generated LLM completion
return completions_results['choices'][0]['message']['content'], False
- Ngôn ngữ chính
- Python
- Star
- 505
- Fork
- 1.1k
- Merge trung bình
- 3 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Azure-Samples/rag-postgres-openai-python
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Azure-Samples/rag-postgres-openai-python#288 · 1 bình luận ·
-
Azure-Samples/rag-postgres-openai-python#273 · 1 người được giao ·
-
Azure-Samples/rag-postgres-openai-python#269 · 1 reaction · 1 người được giao ·
-
Azure-Samples/rag-postgres-openai-python#261 · 1 reaction · 1 người được giao ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Tất cả issue của Azure-Samples/rag-postgres-openai-python
Issue tương tự
-
essnmx good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
-
[Feature] 奇物选择添加优先级 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
syfoud/Simulated_Scepter#174 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Giskard-AI/giskard-oss#2840 · 1 bình luận ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Đang mởarea: repo bug perceived difficulty: 2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
yeti-platform/yeti#1380 ·