Skip to content

Commit

Permalink
Ensure entity types to be str in prompt tune (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlonsoGuevara authored Aug 24, 2024
1 parent 13e17d2 commit e15df44
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .semversioner/next-release/patch-20240823225051898406.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "patch",
"description": "Ensure entity types to be str when running prompt tuning"
}
2 changes: 1 addition & 1 deletion graphrag/prompt_tune/generator/entity_extraction_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def create_entity_extraction_prompt(
else UNTYPED_GRAPH_EXTRACTION_PROMPT
)
if isinstance(entity_types, list):
entity_types = ", ".join(entity_types)
entity_types = ", ".join(map(str, entity_types))

tokens_left = (
max_token_count
Expand Down
4 changes: 3 additions & 1 deletion graphrag/prompt_tune/generator/entity_relationship.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ async def generate_entity_relationship_examples(

if entity_types:
entity_types_str = (
entity_types if isinstance(entity_types, str) else ", ".join(entity_types)
entity_types
if isinstance(entity_types, str)
else ", ".join(map(str, entity_types))
)

messages = [
Expand Down

0 comments on commit e15df44

Please sign in to comment.