-
Notifications
You must be signed in to change notification settings - Fork 65
[llm unify 4/n] extract properties #1149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Henry Lindeman <hmlindeman@yahoo.com>
…e use entity Signed-off-by: Henry Lindeman <hmlindeman@yahoo.com>
Signed-off-by: Henry Lindeman <hmlindeman@yahoo.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks functional, have some clarifying questions
|
||
|
||
class ExtractPropertiesFromSchemaPrompt(SimplePrompt): | ||
class _ExtractPropertiesFromSchemaPrompt(SimplePrompt): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may as well delete
|
||
format_args = self.kwargs | ||
format_args = copy.deepcopy(self.kwargs) | ||
format_args["doc_text"] = doc.text_representation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this used for anything? in other places too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for element based prompts, shouldn't you only be using element text
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically ElementListIterPrompt is a document prompt - so this lets you go "Actually I don't want this prompt to care about the element text" and do something like
newprompt = oldprompt.set(user="""\
Extract the {entity} from the text. This is your {doc_property_i}th try.
Text Representation:
{doc_text}
""")
without having to change the class or implementation of the object. It doesn't necessarily get used but it should be available to be used if the user want imo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah
text += textwrap.dedent( | ||
f"""\ | ||
{i} {field.name}: type={field.field_type}: default={field.default} | ||
{field.description}\n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe only add this and examples if they exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
|
||
if entity == "None": | ||
entity = {} | ||
if isinstance(self._schema, Schema): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I get what's happening in these conditions but it's seeming a bit magical, are you able to comment or simplify/rename?
Or can you points to tests for these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep.
and it is brittle
Signed-off-by: Henry Lindeman <hmlindeman@yahoo.com>
Signed-off-by: Henry Lindeman <hmlindeman@yahoo.com>
if match: | ||
return json.loads(match.group(1)) | ||
else: | ||
raise exc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you actually log the response? If I recall the default exception doesn't so we didn't know what was happening
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops didn't mean to commit that
Signed-off-by: Henry Lindeman <hmlindeman@yahoo.com>
behavioral change:
now puts extracted properties in the property keyed by the name of the entity extracted