Skip to content

Commit

Permalink
solve some comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
SonglinLyu committed Jan 16, 2025
1 parent 3e934c2 commit fdb653f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dbgpt/rag/transformer/intent_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def drop(self):
"""Do nothing by default."""

def _parse_response(self, text: str) -> Dict:
"""Parse llm response."""
"""
Parse llm response.
The returned diction should contain the following content.
{
"category": "Type of the given question.",
Expand Down
14 changes: 7 additions & 7 deletions dbgpt/rag/transformer/text2gql.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
import logging
import re
from typing import Dict, List
from typing import Dict, List, Union

from dbgpt.core import BaseMessage, HumanPromptTemplate, LLMClient
from dbgpt.rag.transformer.llm_translator import LLMTranslator
Expand Down Expand Up @@ -69,12 +69,12 @@ def __init__(self, llm_client: LLMClient, model_name: str):

def _format_messages(self, text: str, history: str = None) -> List[BaseMessage]:
# translate intention to gql with single prompt only.
intention = json.loads(text)
question = intention["rewritten_question"]
category = intention["category"]
entities = intention["entities"]
relations = intention["relations"]
schema = intention["schema"]
intention: Dict[str, Union[str, List[str]]] = json.loads(text)
question = intention.get("rewritten_question")
category = intention.get("category")
entities = intention.get("entities")
relations = intention.get("relations")
schema = intention.get("schema")

template = HumanPromptTemplate.from_template(self._prompt_template)

Expand Down
2 changes: 1 addition & 1 deletion dbgpt/storage/knowledge_graph/community_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ async def asimilar_search_with_scores(
json.dumps(intention)
)
try:
query = translation["query"]
query = translation.get("query")
if "LIMIT" not in query:
query += f" LIMIT {self._text_search_topk}"
subgraph = self._graph_store_apdater.query(query=query)
Expand Down

0 comments on commit fdb653f

Please sign in to comment.