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

better parser for step call #18

Merged
merged 2 commits into from
Dec 13, 2024
Merged

better parser for step call #18

merged 2 commits into from
Dec 13, 2024

Conversation

TonioSnowden
Copy link
Collaborator

@TonioSnowden TonioSnowden commented Dec 12, 2024

Works best for :

from notte.env import NotteEnv
import litellm

goal = "Find best flights from Boston to Tokyo on google flights"
messages = [{"role": "system", "content": goal}]
max_steps = 10

def llm_agent(messages):
    response = litellm.completion(
        model="cerebras/llama3.1-70b",
        messages=messages,
    )
    return response.choices[0].message.content

async def main(max_steps=10):
    async with NotteEnv(headless=False) as env:
        while '<done>' not in messages[-1]['content'] and max_steps > 0:
            resp = llm_agent(messages) # query your llm policy.
            obs = await env.chat(resp) # query notte with llm response.
            messages.append({"role": "assistant", "content": resp})
            messages.append({"role": "user", "content": obs})
            max_steps -= 1

await main()

@TonioSnowden TonioSnowden linked an issue Dec 12, 2024 that may be closed by this pull request
@andreakiro andreakiro self-requested a review December 12, 2024 01:16
Copy link
Contributor

@andreakiro andreakiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+Precommits are failing, install and fix them before we merge

pre-commit install

@andreakiro andreakiro merged commit d6f9b6e into main Dec 13, 2024
1 check passed
@andreakiro andreakiro deleted the better_parser branch December 13, 2024 00:46
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

Successfully merging this pull request may close these issues.

Parser doesn't fit the correct structure
3 participants