Skip to content
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

Merged
merged 13 commits into from
Dec 16, 2024

Conversation

MichalAI21
Copy link

  • Add schemas to create/modify plan.
  • In plan creation/modify: code arg can be a callable, schema can be a class

@github-actions github-actions bot added the documentation Documentation Update label Dec 12, 2024
@MichalAI21 MichalAI21 changed the base branch from main to rc_assistant_api_support December 12, 2024 12:40
@MichalAI21 MichalAI21 changed the title Adapt assistant sdk to hlp Fix: Adapt assistant sdk to hlp Dec 12, 2024
@MichalAI21 MichalAI21 changed the title Fix: Adapt assistant sdk to hlp fix: Adapt assistant sdk to hlp Dec 12, 2024
@github-actions github-actions bot added size:xl and removed size:l labels Dec 15, 2024
@MichalAI21 MichalAI21 force-pushed the adapt-assistant-sdk-to-hlp branch from 4d0addc to 2006f58 Compare December 15, 2024 13:34
Comment on lines 54 to 57
if schemas is NOT_GIVEN:
schema_dicts = NOT_GIVEN
else:
schema_dicts = [self._parse_schema(schema) for schema in schemas]
Copy link
Contributor

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}"
Copy link
Contributor

@Josephasafg Josephasafg Dec 16, 2024

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)

@github-actions github-actions bot added the lgtm Looks Good to Me label Dec 16, 2024
@MichalAI21 MichalAI21 merged commit 78c58d5 into rc_assistant_api_support Dec 16, 2024
21 checks passed
@MichalAI21 MichalAI21 deleted the adapt-assistant-sdk-to-hlp branch December 16, 2024 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation Update lgtm Looks Good to Me size:xl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants