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

Possible bug: only the last message is recognized by the assistant when sending to /openai/chat/completions #1462

Closed
PatrickNercessian opened this issue Sep 20, 2024 · 2 comments

Comments

@PatrickNercessian
Copy link

Describe the bug

if type(last_message.content) == str:
async_interpreter.messages.append(
{
"role": "user",
"type": "message",
"content": last_message.content,
}
)
print(">", last_message.content)
elif type(last_message.content) == list:
for content in last_message.content:
if content["type"] == "text":
async_interpreter.messages.append(
{"role": "user", "type": "message", "content": str(content)}
)

Not sure if this is intentional or not, but doesn't seem like it to me?

Reproduce

Send a message like

url = "http://localhost:8000/openai/chat/completions"
headers = {"Content-Type": "application/json"}
data = {"auth": "dummy-api-key", "messages": [{"role": "user", "content": "Hello! Can you use python to generate 93 raised to the 4th power"}, {"role": "user", "content": "What was the last message I sent, if any?"}]}
response = requests.post(url, headers=headers, data=json.dumps(data))

data = {"auth": "dummy-api-key", "messages": [{"role": "user", "content": "{START}"}]}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())

Expected behavior

Multiple messages to be sent and received

Screenshots

No response

Open Interpreter version

0.3.10

Python version

python:3.11.8

Operating System name and version

Debian

Additional context

No response

@MikeBirdTech
Copy link
Collaborator

Hey @PatrickNercessian
I'm not able to reproduce this. Can you give a more detailed explanation how you got to this point?
Thanks!

@PatrickNercessian
Copy link
Author

Hey, thanks for following up. I think maybe it is actually intentional? I am not sure.

But the code in reproduce should reproduce it. I am running OpenInterpreter by building the Docker image and running the server that way. Then running the reproduce code locally, outside the container.

But you can even tell from the linked code block, it only grabs the last message

This no longer affects me because I built my own server code for using OpenInterpreter, so feel free to close or leave this open!

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

2 participants