-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix: Adapt assistant sdk to hlp #242
fix: Adapt assistant sdk to hlp #242
Conversation
MichalAI21
commented
Dec 12, 2024
- Add schemas to create/modify plan.
- In plan creation/modify: code arg can be a callable, schema can be a class
4d0addc
to
2006f58
Compare
if schemas is NOT_GIVEN: | ||
schema_dicts = NOT_GIVEN | ||
else: | ||
schema_dicts = [self._parse_schema(schema) for schema in schemas] |
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.
Great! Can you please move this inline to the call? something like -
return remove_not_given(
{
"code": code,
"code": code_str,
"schemas": [self._parse_schema(schema) for schema in schemas] if schemas is not NOT_GIVEN else NOT_GIVEN,
**kwargs,
}
)
ai21/errors.py
Outdated
|
||
class CodeParsingError(AI21Error): | ||
def __init__(self, details: Optional[str] = None): | ||
message = f"Code can't be parsed: {details}" |
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.
If you pass None
here the message would be
Code can't be parsed: None
That's a strange behavior for the user.
Perhaps something like this -
class CodeParsingError(AI21Error):
def __init__(self, details: Optional[str] = None, message: Optional[str] = None):
self.message = message or f"Failed to parse code: {details or 'No details provided'}"
super().__init__(self.message)