pieces-app / pieces-os-client-sdk-for-python

The Pieces OS Client SDK is a powerful code engine package designed for writing applications on top of Pieces OS.
MIT License
26 stars 14 forks source link

BUG: Error when running the copilot sample from PYPi #79

Closed jimbobbennett closed 1 month ago

jimbobbennett commented 1 month ago

Bug Description

I am running the copilot sample from PYPI. I literally copied and pasted the sample, ran it, and I got this error:

  File "/Users/jimbobbennett/github/python-demo/app.py", line 9, in <module>
    for response in pieces_client.copilot.stream_question(question):
  File "/Users/jimbobbennett/github/python-demo/.venv/lib/python3.10/site-packages/pieces_os_client/wrapper/copilot.py", line 78, in _return_on_message
    self.chat = BasicChat(message.conversation)  # Save the conversation
  File "/Users/jimbobbennett/github/python-demo/.venv/lib/python3.10/site-packages/pieces_os_client/wrapper/copilot.py", line 142, in chat
    self._chat_id = chat.id if chat else None
  File "/Users/jimbobbennett/github/python-demo/.venv/lib/python3.10/site-packages/pieces_os_client/wrapper/basic_identifier/chat.py", line 26, in id
    return self.conversation.id
  File "/Users/jimbobbennett/github/python-demo/.venv/lib/python3.10/site-packages/pieces_os_client/wrapper/basic_identifier/chat.py", line 15, in conversation
    raise ValueError("Conversation not found")
ValueError: Conversation not found

Code sample is from https://pypi.org/project/pieces_os_client/:

from pieces_os_client.wrapper import PiecesClient

pieces_client = PiecesClient()

# Set the question you want to ask
question = "What is Object-Oriented Programming?"

# Ask the question and stream the response
for response in pieces_client.copilot.stream_question(question):
   if response.question:
         # Each answer is a chunk of the entire response to the question
         answers = response.question.answers.iterable
         for answer in answers:
            print(answer.text,end="")

# Close the client
pieces_client.close()

Steps to Reproduce

  1. Create a new Python venv and install pieces OS client
  2. Create a new Python file and add the code from the sample
  3. Run the code. You get an answer, then this exception is thrown.

Your operating system

MacOS

Your python version (python -V)

Python 3.10.x

Your Pieces OS Version

10.1.6

Additional Info

No response