Skip to content

쿼리 실행시 간헐적으로 에러 발생 : AttributeError: 'AIMessage' object has no attribute 'encode' #87

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

Closed
1 task done
ParkGyeongTae opened this issue Apr 30, 2025 · 0 comments
Assignees

Comments

@ParkGyeongTae
Copy link
Contributor

ParkGyeongTae commented Apr 30, 2025

Why❓

  • 쿼리 실행시 간헐적으로 에러 발생 : AttributeError: 'AIMessage' object has no attribute 'encode'
  • 같은 질문을 반복적으로 실행해도 성공과 실패가 랜덤하게 나타남.

How❓

  • 디버깅 및 코드 수정

What❓

  • 코드 수정

에러내용

2025-04-30 18:27:54.873 Uncaught app execution
Traceback (most recent call last):
  File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling
    result = func()
             ^^^^^^
  File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 579, in code_to_exec
    exec(code, module.__dict__)
  File "/Users/pgt0409/Desktop/git/Lang2SQL/interface/streamlit_app.py", line 75, in <module>
    st.navigation(pages).run()
  File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/streamlit/navigation/page.py", line 303, in run
    exec(code, module.__dict__)
  File "/Users/pgt0409/Desktop/git/Lang2SQL/interface/lang2sql.py", line 219, in <module>
    display_result(res=result, database=db)
  File "/Users/pgt0409/Desktop/git/Lang2SQL/interface/lang2sql.py", line 150, in display_result
    df = database.run_sql(sql)
         ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pgt0409/Desktop/git/Lang2SQL/llm_utils/connect_db.py", line 44, in run_sql
    raise e
  File "/Users/pgt0409/Desktop/git/Lang2SQL/llm_utils/connect_db.py", line 34, in run_sql
    result = self.client.execute(sql, with_column_types=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/clickhouse_driver/client.py", line 382, in execute
    rv = self.process_ordinary_query(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/clickhouse_driver/client.py", line 577, in process_ordinary_query
    self.connection.send_query(query, query_id=query_id, params=params)
  File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/clickhouse_driver/connection.py", line 723, in send_query
    write_binary_str(query, self.fout)
  File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/clickhouse_driver/writer.py", line 15, in write_binary_str
    text = text.encode('utf-8')
           ^^^^^^^^^^^
  File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/pydantic/main.py", line 891, in __getattr__
    raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')
AttributeError: 'AIMessage' object has no attribute 'encode'
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

No branches or pull requests

1 participant