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

Interpreter Error with Multi-line Code Strings due to String Literal Formatting #135

Closed
erickfm opened this issue Oct 17, 2023 · 1 comment · Fixed by #136
Closed

Interpreter Error with Multi-line Code Strings due to String Literal Formatting #135

erickfm opened this issue Oct 17, 2023 · 1 comment · Fixed by #136

Comments

@erickfm
Copy link
Contributor

erickfm commented Oct 17, 2023

I'm getting a SyntaxError: unterminated string literal from time to time on various runs. It only affects multi-line code strings and sometimes it resolves but other times it causes the interpreter to hit the iteration limit. The query causing the issue can vary. I can coerce this bug out with some additional guidelines in my request like "don't use a line break at the start of a code string" but it isn't ideal.

Here's the code causing the error:

from codeinterpreterapi import CodeInterpreterSession, schema, settings

settings.TEMPERATURE = 0
files = [schema.File.from_path('synthetic_cancer_patient_data.csv')]

def chat(prompt):
    with CodeInterpreterSession(model='gpt-4') as session:
      print('session:', session)
      response = session.generate_response(
          prompt,
          files
      )
      for file in response.files:
          file.show_image()
    return response.content, response


response, r = chat(prompt)
print(response)

Here's a screenshot of the Error in LangSmith:
Screenshot 2023-10-17 at 2 04 29 AM

@erickfm
Copy link
Contributor Author

erickfm commented Oct 17, 2023

Here's the output after the changes from #136

Screenshot 2023-10-17 at 3 57 13 AM

dataset is synthetic data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant