Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion prometheus/git/git_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
25 changes: 14 additions & 11 deletions prometheus/lang_graph/nodes/context_refine_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand All @@ -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}"),
]
)
Expand All @@ -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,
)
Expand Down