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

In Willy Douhard's bigquery cookbook example - missing to_openai() method #105

Open
johnlabuyfoy1024 opened this issue Apr 30, 2024 · 0 comments

Comments

@johnlabuyfoy1024
Copy link

johnlabuyfoy1024 commented Apr 30, 2024

I have configured Google Cloud successfully however, when I ran the bigquery Python example from the Cookbook with my first text question, I get the following error:
2024-04-30 14:17:52 - 'dict' object has no attribute 'to_openai'
Traceback (most recent call last):
File "C:\Users\johnl\PycharmProjects\bigquery\vnew\Lib\site-packages\chainlit\utils.py", line 39, in wrapper
return await user_function(**params_values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\johnl\PycharmProjects\bigquery\app.py", line 139, in main
await chain(message.content)
File "C:\Users\johnl\PycharmProjects\bigquery\vnew\Lib\site-packages\chainlit\step.py", line 84, in async_wrapper
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\johnl\PycharmProjects\bigquery\app.py", line 131, in chain
sql_query = await gen_query(human_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\johnl\PycharmProjects\bigquery\vnew\Lib\site-packages\chainlit\step.py", line 84, in async_wrapper
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\johnl\PycharmProjects\bigquery\app.py", line 57, in gen_query
messages=[m.to_openai() for m in current_step.generation.messages],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\johnl\PycharmProjects\bigquery\app.py", line 57, in
messages=[m.to_openai() for m in current_step.generation.messages],
^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'to_openai'

From this code snippet:

# Call OpenAI and stream the message
stream_resp = await openai_client.chat.completions.create(
    messages=[m.to_openai() for m in current_step.generation.messages],
    stream=True,
    **settings
)

Any help would be appreciated - I like this example very much! Please advise & thanks.

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