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

Handle incomplete response #31

Open
cliffckerr opened this issue Dec 17, 2024 · 0 comments
Open

Handle incomplete response #31

cliffckerr opened this issue Dec 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@cliffckerr
Copy link
Member

cliffckerr commented Dec 17, 2024

If the output is too long and gets truncated, then

        json = self.response.to_json()
        result_string = json['kwargs']['content']
        match_pattern = re.compile(r'```python(.*?)```', re.DOTALL)
        code_match = match_pattern.search(result_string)
        self.new_str = code_match.group(1)

fails with

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cliffk/idm/starsim_ai/starsim_ai/migration.py", line 80, in parse_response
    self.new_str = code_match.group(1)
                   ^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'

Need to make more robust -- only search for ```python, and then separately search for ``` at the end, perhaps?

@cliffckerr cliffckerr added the bug Something isn't working label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant