Skip to content

Multiple interaction with AI works only in Linux. In Windows - does not work. #277

Open
@longnetwork

Description

@longnetwork

Test Code work only in Linux:

import together


def interact():
    
    client = together.Together(api_key='...')

    messages = [{"role": "system", "content": "You are a news aggregator"}]

    while True:
        
        response = client.chat.completions.create(
            model='meta-llama/Llama-3.3-70B-Instruct-Turbo',
            messages = messages,
            stream = False,
        )
        choices = [ {'role': choice.message.role, 'content': choice.message.content} for choice in response.choices if choice.message.role == 'assistant' ]
        messages += choices
        
        user_message = yield '\n'.join(c['content'] for c in choices)

        messages += [{"role": "user", "content": user_message}]


# Test Code

generator = interact(); generator.send(None)

while True:
    print("\n-->")
    
    user_message = ''
    while True:
        line = input()
        user_message += line + '\n'
        if user_message.endswith('\n\n\n'):
            user_message = user_message.strip()
            break

    print("<--")

    response = generator.send(user_message)
    
    print(response)

Conlose outputs in Linux - OK

Image

Console outputs in Windows - BUGGY

Image
Image
Image

In Windows only the first interaction works. The rest of the interactions are sprinkled with exceptions.
Other providers compatible with OpenAI work well in Windows (on the same test code)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions