[Add] browser-use and main.py
This commit is contained in:
parent
08e64bdf45
commit
96914d44ac
221 changed files with 30952 additions and 1 deletions
42
browser-use/examples/models/_ollama.py
Normal file
42
browser-use/examples/models/_ollama.py
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# Optional: Disable telemetry
|
||||
# os.environ["ANONYMIZED_TELEMETRY"] = "false"
|
||||
|
||||
# Optional: Set the OLLAMA host to a remote server
|
||||
# os.environ["OLLAMA_HOST"] = "http://x.x.x.x:11434"
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
from langchain_ollama import ChatOllama
|
||||
|
||||
from browser_use import Agent
|
||||
from browser_use.agent.views import AgentHistoryList
|
||||
|
||||
|
||||
async def run_search() -> AgentHistoryList:
|
||||
agent = Agent(
|
||||
task="Search for a 'browser use' post on the r/LocalLLaMA subreddit and open it.",
|
||||
llm=ChatOllama(
|
||||
model='qwen2.5:32b-instruct-q4_K_M',
|
||||
num_ctx=32000,
|
||||
),
|
||||
)
|
||||
|
||||
result = await agent.run()
|
||||
return result
|
||||
|
||||
|
||||
async def main():
|
||||
result = await run_search()
|
||||
print('\n\n', result)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue