From ee2b71326598b4c92ee338b89901215fcd79110e Mon Sep 17 00:00:00 2001 From: Yue Pan <79363355+dcloud347@users.noreply.github.com> Date: Mon, 11 Aug 2025 16:30:58 +0800 Subject: [PATCH 1/2] Update GitHub token format for repository cloning --- prometheus/git/git_repository.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prometheus/git/git_repository.py b/prometheus/git/git_repository.py index 6f65ae08..2619cbd3 100644 --- a/prometheus/git/git_repository.py +++ b/prometheus/git/git_repository.py @@ -62,7 +62,7 @@ async def from_clone_repository( Returns: Repo: GitPython Repo object representing the cloned repository. """ - https_url = https_url.replace("https://", f"https://{github_access_token}@") + https_url = https_url.replace("https://", f"https://x-access-token:{github_access_token}@") repo_name = https_url.split("/")[-1].split(".")[0] local_path = target_directory / repo_name if local_path.exists(): From 5da5c7186da57147d6953e4cbcb9e07cefa561a6 Mon Sep 17 00:00:00 2001 From: Yue Pan <79363355+dcloud347@users.noreply.github.com> Date: Mon, 11 Aug 2025 16:56:57 +0800 Subject: [PATCH 2/2] Refine output format and enhance context analysis in ContextRefineStructuredOutput --- .../lang_graph/nodes/context_refine_node.py | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/prometheus/lang_graph/nodes/context_refine_node.py b/prometheus/lang_graph/nodes/context_refine_node.py index 1cfc4ee1..576025ec 100644 --- a/prometheus/lang_graph/nodes/context_refine_node.py +++ b/prometheus/lang_graph/nodes/context_refine_node.py @@ -34,18 +34,21 @@ class ContextRefineNode: 2. The additional context would only provide nice-to-have but non-essential details 3. The information is redundant with what's already available -Output format: -```python -class ContextRefineStructuredOutput(BaseModel): - reasoning: str # Why current context is/isn't enough - refined_query: str # Additional query to ask the ContextRetriever if the context is not enough. Empty otherwise +Provide your analysis in a structured format matching the ContextRefineStructuredOutput model. + +Example output: +```json +{{ + "reasoning": "1. The current context includes the main function implementation but lacks details on helper functions it calls.\n2. The query requires understanding of how data is processed, which is not fully covered in the provided context.\n3. The documentation for the main function is missing, which could provide insights into its intended behavior.\n4. Therefore, additional context is needed to fully understand and address the user's query.", + "refined_query": "Please provide the implementation details of the helper functions called within the main function, as well as any relevant documentation that explains the overall data processing workflow." +}} ``` - -The codebase structure: -{file_tree} """ REFINE_PROMPT = """\ +This is the codebase structure: +{file_tree} + This is the original user query: {original_query} @@ -70,11 +73,10 @@ class ContextRefineStructuredOutput(BaseModel): """ def __init__(self, model: BaseChatModel, kg: KnowledgeGraph): - file_tree = kg.get_file_tree().replace("{", "{{").replace("}", "}}") - system_prompt = self.SYS_PROMPT.format(file_tree=file_tree) + self.file_tree = kg.get_file_tree() prompt = ChatPromptTemplate.from_messages( [ - ("system", system_prompt), + ("system", self.SYS_PROMPT), ("human", "{human_prompt}"), ] ) @@ -88,6 +90,7 @@ def format_refine_message(self, state: ContextRetrievalState): original_query = state["query"] context = "\n\n".join([str(context) for context in state["context"]]) return self.REFINE_PROMPT.format( + file_tree=self.file_tree, original_query=original_query, context=context, )