lumivor 0.1.7__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. lumivor-0.1.7/.env.example +8 -0
  2. lumivor-0.1.7/.gitattributes +2 -0
  3. lumivor-0.1.7/.github/workflows/publish.yml +38 -0
  4. lumivor-0.1.7/.gitignore +179 -0
  5. lumivor-0.1.7/.python-version +1 -0
  6. lumivor-0.1.7/.vscode/launch.json +88 -0
  7. lumivor-0.1.7/LICENSE +21 -0
  8. lumivor-0.1.7/PKG-INFO +100 -0
  9. lumivor-0.1.7/README.md +70 -0
  10. lumivor-0.1.7/conftest.py +10 -0
  11. lumivor-0.1.7/examples/amazon_search.py +28 -0
  12. lumivor-0.1.7/examples/captcha.py +30 -0
  13. lumivor-0.1.7/examples/check_appointment.py +41 -0
  14. lumivor-0.1.7/examples/clipboard.py +59 -0
  15. lumivor-0.1.7/examples/custom_output.py +55 -0
  16. lumivor-0.1.7/examples/custom_system_prompt.py +36 -0
  17. lumivor-0.1.7/examples/file_upload.py +91 -0
  18. lumivor-0.1.7/examples/find_and_apply_to_jobs.py +158 -0
  19. lumivor-0.1.7/examples/gemini.py +33 -0
  20. lumivor-0.1.7/examples/multi-tab_handling.py +28 -0
  21. lumivor-0.1.7/examples/multiple_agents_same_browser.py +34 -0
  22. lumivor-0.1.7/examples/notification.py +44 -0
  23. lumivor-0.1.7/examples/parallel_agents.py +55 -0
  24. lumivor-0.1.7/examples/post-twitter.py +121 -0
  25. lumivor-0.1.7/examples/qwen.py +31 -0
  26. lumivor-0.1.7/examples/real_browser.py +43 -0
  27. lumivor-0.1.7/examples/result_processing.py +63 -0
  28. lumivor-0.1.7/examples/save_to_file_hugging_face.py +47 -0
  29. lumivor-0.1.7/examples/save_trace.py +32 -0
  30. lumivor-0.1.7/examples/scrolling_page.py +34 -0
  31. lumivor-0.1.7/examples/test_cv.txt +1 -0
  32. lumivor-0.1.7/examples/try.py +72 -0
  33. lumivor-0.1.7/examples/validate_output.py +50 -0
  34. lumivor-0.1.7/examples/web_voyager_agent.py +58 -0
  35. lumivor-0.1.7/lumivor/README.md +51 -0
  36. lumivor-0.1.7/lumivor/__init__.py +25 -0
  37. lumivor-0.1.7/lumivor/agent/message_manager/service.py +252 -0
  38. lumivor-0.1.7/lumivor/agent/message_manager/tests.py +246 -0
  39. lumivor-0.1.7/lumivor/agent/message_manager/views.py +37 -0
  40. lumivor-0.1.7/lumivor/agent/prompts.py +208 -0
  41. lumivor-0.1.7/lumivor/agent/service.py +1017 -0
  42. lumivor-0.1.7/lumivor/agent/tests.py +204 -0
  43. lumivor-0.1.7/lumivor/agent/views.py +272 -0
  44. lumivor-0.1.7/lumivor/browser/browser.py +208 -0
  45. lumivor-0.1.7/lumivor/browser/context.py +993 -0
  46. lumivor-0.1.7/lumivor/browser/tests/screenshot_test.py +38 -0
  47. lumivor-0.1.7/lumivor/browser/tests/test_clicks.py +77 -0
  48. lumivor-0.1.7/lumivor/browser/views.py +48 -0
  49. lumivor-0.1.7/lumivor/controller/registry/service.py +140 -0
  50. lumivor-0.1.7/lumivor/controller/registry/views.py +71 -0
  51. lumivor-0.1.7/lumivor/controller/service.py +557 -0
  52. lumivor-0.1.7/lumivor/controller/views.py +47 -0
  53. lumivor-0.1.7/lumivor/dom/__init__.py +0 -0
  54. lumivor-0.1.7/lumivor/dom/buildDomTree.js +428 -0
  55. lumivor-0.1.7/lumivor/dom/history_tree_processor/service.py +112 -0
  56. lumivor-0.1.7/lumivor/dom/history_tree_processor/view.py +33 -0
  57. lumivor-0.1.7/lumivor/dom/service.py +100 -0
  58. lumivor-0.1.7/lumivor/dom/tests/extraction_test.py +44 -0
  59. lumivor-0.1.7/lumivor/dom/tests/process_dom_test.py +40 -0
  60. lumivor-0.1.7/lumivor/dom/views.py +187 -0
  61. lumivor-0.1.7/lumivor/logging_config.py +128 -0
  62. lumivor-0.1.7/lumivor/telemetry/service.py +114 -0
  63. lumivor-0.1.7/lumivor/telemetry/views.py +51 -0
  64. lumivor-0.1.7/lumivor/utils.py +54 -0
  65. lumivor-0.1.7/pyproject.toml +47 -0
  66. lumivor-0.1.7/pytest.ini +29 -0
  67. lumivor-0.1.7/static/lumivor.png +0 -0
  68. lumivor-0.1.7/tests/mind2web_data/processed.json +16858 -0
  69. lumivor-0.1.7/tests/test_agent_actions.py +224 -0
  70. lumivor-0.1.7/tests/test_attach_chrome.py +70 -0
  71. lumivor-0.1.7/tests/test_core_functionality.py +202 -0
  72. lumivor-0.1.7/tests/test_dropdown.py +41 -0
  73. lumivor-0.1.7/tests/test_full_screen.py +22 -0
  74. lumivor-0.1.7/tests/test_mind2web.py +138 -0
  75. lumivor-0.1.7/tests/test_qwen.py +71 -0
  76. lumivor-0.1.7/tests/test_self_registered_actions.py +198 -0
  77. lumivor-0.1.7/tests/test_stress.py +115 -0
  78. lumivor-0.1.7/tests/test_vision.py +56 -0
@@ -0,0 +1,8 @@
1
+ OPENAI_API_KEY=
2
+ ANTHROPIC_API_KEY=
3
+
4
+ # Set to false to disable anonymized telemetry
5
+ ANONYMIZED_TELEMETRY=true
6
+
7
+ # LogLevel: Set to debug to enable verbose logging, set to result to get results only. Available: result | debug | info
8
+ LUMIVOR_LOGGING_LEVEL=info
@@ -0,0 +1,2 @@
1
+ static/*.gif filter=lfs diff=lfs merge=lfs -text
2
+ # static/*.mp4 filter=lfs diff=lfs merge=lfs -text
@@ -0,0 +1,38 @@
1
+ # This workflow will upload a Python Package using Twine when a release is created
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3
+
4
+ # This workflow uses actions that are not certified by GitHub.
5
+ # They are provided by a third-party and are governed by
6
+ # separate terms of service, privacy policy, and support
7
+ # documentation.
8
+
9
+ name: Upload Python Package
10
+
11
+ on:
12
+ release:
13
+ types: [published]
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ jobs:
19
+ deploy:
20
+ runs-on: ubuntu-latest
21
+
22
+ steps:
23
+ - uses: actions/checkout@v3
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v3
26
+ with:
27
+ python-version: "3.x"
28
+ - name: Install dependencies
29
+ run: |
30
+ python -m pip install --upgrade pip
31
+ pip install build hatch
32
+ - name: Build package
33
+ run: python -m build
34
+ - name: Publish package
35
+ uses: pypa/gh-action-pypi-publish@release/v1
36
+ with:
37
+ user: __token__
38
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,179 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
+ .pdm.toml
111
+ .pdm-python
112
+ .pdm-build/
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+ test_env/
133
+
134
+
135
+ # Spyder project settings
136
+ .spyderproject
137
+ .spyproject
138
+
139
+ # Rope project settings
140
+ .ropeproject
141
+
142
+ # mkdocs documentation
143
+ /site
144
+
145
+ # mypy
146
+ .mypy_cache/
147
+ .dmypy.json
148
+ dmypy.json
149
+
150
+ # Pyre type checker
151
+ .pyre/
152
+
153
+ # pytype static type analyzer
154
+ .pytype/
155
+
156
+ # Cython debug symbols
157
+ cython_debug/
158
+
159
+ # PyCharm
160
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
161
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
162
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
163
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
164
+ #.idea/
165
+ temp
166
+ tmp
167
+
168
+
169
+ .DS_Store
170
+
171
+ private_example.py
172
+ private_example
173
+
174
+ browser_cookies.json
175
+ cookies.json
176
+ AgentHistory.json
177
+ cv_04_24.pdf
178
+ AgentHistoryList.json
179
+ *.gif
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,88 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "name": "Python Debugger: Current File",
6
+ "type": "debugpy",
7
+ "request": "launch",
8
+ "program": "${file}",
9
+ "justMyCode": false,
10
+ "env": {
11
+ "PYTHONPATH": "${workspaceFolder}"
12
+ },
13
+ "console": "integratedTerminal"
14
+ },
15
+ {
16
+ "name": "Python Debugger: Module",
17
+ "type": "debugpy",
18
+ "request": "launch",
19
+ "module": "examples.extend_actions"
20
+ },
21
+ {
22
+ "name": "Python: Debug extend_actions",
23
+ "type": "module",
24
+ "request": "launch",
25
+ "module": "examples.extend_actions",
26
+ "console": "integratedTerminal",
27
+ "justMyCode": false,
28
+ "env": {
29
+ "PYTHONPATH": "${workspaceFolder}"
30
+ }
31
+ },
32
+ {
33
+ "name": "Python: Debug Captcha Tests",
34
+ "type": "python",
35
+ "request": "launch",
36
+ "module": "pytest",
37
+ "args": [
38
+ "tests/test_agent_actions.py",
39
+ "-v",
40
+ "-k",
41
+ "test_captcha_solver",
42
+ "--capture=no",
43
+ ],
44
+ "console": "integratedTerminal",
45
+ "justMyCode": false
46
+ },
47
+ {
48
+ "name": "Python: Debug Ecommerce Interaction",
49
+ "type": "python",
50
+ "request": "launch",
51
+ "module": "pytest",
52
+ "args": [
53
+ "tests/test_agent_actions.py",
54
+ "-v",
55
+ "-k",
56
+ "test_ecommerce_interaction",
57
+ "--capture=no",
58
+ ],
59
+ "console": "integratedTerminal",
60
+ "justMyCode": false
61
+ },
62
+ {
63
+ "name": "Python: Debug Core Functionality",
64
+ "type": "python",
65
+ "request": "launch",
66
+ "program": "${workspaceFolder}/.venv/bin/pytest",
67
+ "args": [
68
+ "tests/test_core_functionality.py",
69
+ "-v"
70
+ ],
71
+ "console": "integratedTerminal",
72
+ "justMyCode": false
73
+ },
74
+ {
75
+ "name": "pytest: Debug Current File",
76
+ "type": "python",
77
+ "request": "launch",
78
+ "module": "pytest",
79
+ "args": [
80
+ "${file}",
81
+ "-v",
82
+ "--capture=no"
83
+ ],
84
+ "console": "integratedTerminal",
85
+ "justMyCode": false
86
+ }
87
+ ]
88
+ }
lumivor-0.1.7/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Lumivor Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
lumivor-0.1.7/PKG-INFO ADDED
@@ -0,0 +1,100 @@
1
+ Metadata-Version: 2.4
2
+ Name: lumivor
3
+ Version: 0.1.7
4
+ Summary: Seamlessly Integrating AI with the Web
5
+ License-File: LICENSE
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Operating System :: OS Independent
8
+ Classifier: Programming Language :: Python :: 3
9
+ Requires-Python: >=3.11
10
+ Requires-Dist: beautifulsoup4>=4.12.3
11
+ Requires-Dist: httpx>=0.27.2
12
+ Requires-Dist: langchain-anthropic>=0.3.1
13
+ Requires-Dist: langchain-fireworks>=0.2.5
14
+ Requires-Dist: langchain-google-genai>=2.0.8
15
+ Requires-Dist: langchain-openai>=0.2.14
16
+ Requires-Dist: langchain>=0.3.14
17
+ Requires-Dist: maincontentextractor>=0.0.4
18
+ Requires-Dist: playwright>=1.49.0
19
+ Requires-Dist: posthog>=3.7.0
20
+ Requires-Dist: pydantic>=2.10.4
21
+ Requires-Dist: python-dotenv>=1.0.1
22
+ Requires-Dist: requests>=2.32.3
23
+ Provides-Extra: dev
24
+ Requires-Dist: build>=1.2.2; extra == 'dev'
25
+ Requires-Dist: hatch>=1.13.0; extra == 'dev'
26
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
27
+ Requires-Dist: pytest>=8.3.3; extra == 'dev'
28
+ Requires-Dist: tokencost>=0.1.16; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ <img src="./static/lumivor.png" alt="Lumivor Logo" width="full"/>
32
+
33
+ <br/>
34
+
35
+ [![Documentation](https://img.shields.io/badge/Documentation-📕-blue)](https://Lumivor-Labs.github.io)
36
+ [![Twitter Follow](https://img.shields.io/twitter/follow/lumivor_labs?style=social)](https://x.com/lumivor_labs)
37
+
38
+ Seamlessly Integrating AI with the Web
39
+
40
+ We enable AI systems to interact with websites by pinpointing and isolating essential interactive elements for smooth navigation.
41
+
42
+ To learn more about the library, check out the [documentation 📕](https://Lumivor-Labs.github.io).
43
+
44
+ # Quick start
45
+
46
+ With pip:
47
+
48
+ ```bash
49
+ pip install lumivor
50
+ ```
51
+
52
+ (optional) install playwright:
53
+
54
+ ```bash
55
+ playwright install
56
+ ```
57
+
58
+ Spin up your agent:
59
+
60
+ ```python
61
+ from langchain_openai import ChatOpenAI
62
+ from lumivor import Agent
63
+ import asyncio
64
+
65
+ async def main():
66
+ agent = Agent(
67
+ task="Find a one-way flight from Bali to Oman on 12 January 2025 on Google Flights. Return me the cheapest option.",
68
+ llm=ChatOpenAI(model="gpt-4o"),
69
+ )
70
+ result = await agent.run()
71
+ print(result)
72
+
73
+ asyncio.run(main())
74
+ ```
75
+
76
+ And don't forget to add your API keys to your `.env` file.
77
+
78
+ ```bash
79
+ OPENAI_API_KEY=
80
+ ```
81
+
82
+ For other settings, models, and more, check out the [documentation 📕](https://Lumivor-Labs.github.io).
83
+
84
+ ## Examples
85
+
86
+ For examples see the [examples](examples) folder
87
+
88
+ # Contributing
89
+
90
+ Contributions are welcome! Feel free to open issues for bugs or feature requests.
91
+
92
+ ## Local Setup
93
+
94
+ To learn more about the library, check out the [local setup 📕](https://Lumivor-Labs.github.io/development/local-setup).
95
+
96
+ ---
97
+
98
+ <div align="center">
99
+ Made with ❤️ in Zurich and San Francisco
100
+ </div>
@@ -0,0 +1,70 @@
1
+ <img src="./static/lumivor.png" alt="Lumivor Logo" width="full"/>
2
+
3
+ <br/>
4
+
5
+ [![Documentation](https://img.shields.io/badge/Documentation-📕-blue)](https://Lumivor-Labs.github.io)
6
+ [![Twitter Follow](https://img.shields.io/twitter/follow/lumivor_labs?style=social)](https://x.com/lumivor_labs)
7
+
8
+ Seamlessly Integrating AI with the Web
9
+
10
+ We enable AI systems to interact with websites by pinpointing and isolating essential interactive elements for smooth navigation.
11
+
12
+ To learn more about the library, check out the [documentation 📕](https://Lumivor-Labs.github.io).
13
+
14
+ # Quick start
15
+
16
+ With pip:
17
+
18
+ ```bash
19
+ pip install lumivor
20
+ ```
21
+
22
+ (optional) install playwright:
23
+
24
+ ```bash
25
+ playwright install
26
+ ```
27
+
28
+ Spin up your agent:
29
+
30
+ ```python
31
+ from langchain_openai import ChatOpenAI
32
+ from lumivor import Agent
33
+ import asyncio
34
+
35
+ async def main():
36
+ agent = Agent(
37
+ task="Find a one-way flight from Bali to Oman on 12 January 2025 on Google Flights. Return me the cheapest option.",
38
+ llm=ChatOpenAI(model="gpt-4o"),
39
+ )
40
+ result = await agent.run()
41
+ print(result)
42
+
43
+ asyncio.run(main())
44
+ ```
45
+
46
+ And don't forget to add your API keys to your `.env` file.
47
+
48
+ ```bash
49
+ OPENAI_API_KEY=
50
+ ```
51
+
52
+ For other settings, models, and more, check out the [documentation 📕](https://Lumivor-Labs.github.io).
53
+
54
+ ## Examples
55
+
56
+ For examples see the [examples](examples) folder
57
+
58
+ # Contributing
59
+
60
+ Contributions are welcome! Feel free to open issues for bugs or feature requests.
61
+
62
+ ## Local Setup
63
+
64
+ To learn more about the library, check out the [local setup 📕](https://Lumivor-Labs.github.io/development/local-setup).
65
+
66
+ ---
67
+
68
+ <div align="center">
69
+ Made with ❤️ in Zurich and San Francisco
70
+ </div>
@@ -0,0 +1,10 @@
1
+ import os
2
+ import sys
3
+
4
+ from lumivor.logging_config import setup_logging
5
+
6
+ # Get the absolute path to the project root
7
+ project_root = os.path.dirname(os.path.abspath(__file__))
8
+ sys.path.insert(0, project_root)
9
+
10
+ setup_logging()
@@ -0,0 +1,28 @@
1
+ """
2
+ Simple try of the agent.
3
+
4
+ @dev You need to add OPENAI_API_KEY to your environment variables.
5
+ """
6
+
7
+ from lumivor import Agent
8
+ from langchain_openai import ChatOpenAI
9
+ import asyncio
10
+ import os
11
+ import sys
12
+
13
+ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
14
+
15
+
16
+ llm = ChatOpenAI(model='gpt-4o')
17
+ agent = Agent(
18
+ task='Go to amazon.com, search for laptop, sort by best rating, and give me the price of the first result',
19
+ llm=llm,
20
+ )
21
+
22
+
23
+ async def main():
24
+ await agent.run(max_steps=3)
25
+ agent.create_history_gif()
26
+
27
+
28
+ asyncio.run(main())
@@ -0,0 +1,30 @@
1
+ """
2
+ Simple try of the agent.
3
+
4
+ @dev You need to add OPENAI_API_KEY to your environment variables.
5
+ """
6
+
7
+ from lumivor import Agent
8
+ from langchain_openai import ChatOpenAI
9
+ import asyncio
10
+ import os
11
+ import sys
12
+
13
+ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
14
+
15
+
16
+ # NOTE: captchas are hard. For this example it works. But e.g. for iframes it does not.
17
+ # for this example it helps to zoom in.
18
+ llm = ChatOpenAI(model='gpt-4o')
19
+ agent = Agent(
20
+ task='go to https://captcha.com/demos/features/captcha-demo.aspx and solve the captcha',
21
+ llm=llm,
22
+ )
23
+
24
+
25
+ async def main():
26
+ await agent.run()
27
+ input('Press Enter to exit')
28
+
29
+
30
+ asyncio.run(main())
@@ -0,0 +1,41 @@
1
+ import asyncio
2
+ import os
3
+
4
+ import dotenv
5
+ from langchain_openai import ChatOpenAI
6
+ from pydantic import BaseModel, SecretStr
7
+
8
+ from lumivor.agent.service import Agent
9
+ from lumivor.controller.service import Controller
10
+
11
+ dotenv.load_dotenv()
12
+
13
+
14
+ controller = Controller()
15
+
16
+
17
+ class WebpageInfo(BaseModel):
18
+ link: str = 'https://appointment.mfa.gr/en/reservations/aero/ireland-grcon-dub/'
19
+
20
+
21
+ @controller.action('Go to the webpage', param_model=WebpageInfo)
22
+ def go_to_webpage(webpage_info: WebpageInfo):
23
+ return webpage_info.link
24
+
25
+
26
+ async def main():
27
+ task = (
28
+ 'Go to the Greece MFA webpage via the link I provided you.'
29
+ 'Check the visa appointment dates. If there is no available date in this month, check the next month.'
30
+ 'If there is no available date in both months, tell me there is no available date.'
31
+ )
32
+
33
+ model = ChatOpenAI(model='gpt-4o-mini',
34
+ api_key=SecretStr(os.getenv('OPENAI_API_KEY', '')))
35
+ agent = Agent(task, model, controller=controller, use_vision=True)
36
+
37
+ result = await agent.run()
38
+
39
+
40
+ if __name__ == '__main__':
41
+ asyncio.run(main())
@@ -0,0 +1,59 @@
1
+ from lumivor.browser.context import BrowserContext
2
+ from lumivor.browser.browser import Browser, BrowserConfig
3
+ from lumivor import Agent, Controller
4
+ from langchain_openai import ChatOpenAI
5
+ import pyperclip
6
+ import asyncio
7
+ import os
8
+ import sys
9
+ from pathlib import Path
10
+
11
+ from lumivor.agent.views import ActionResult
12
+
13
+ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
14
+
15
+
16
+ browser = Browser(
17
+ config=BrowserConfig(
18
+ headless=False,
19
+ )
20
+ )
21
+ controller = Controller()
22
+
23
+
24
+ @controller.registry.action('Copy text to clipboard')
25
+ def copy_to_clipboard(text: str):
26
+ pyperclip.copy(text)
27
+ return ActionResult(extracted_content=text)
28
+
29
+
30
+ @controller.registry.action('Paste text from clipboard', requires_browser=True)
31
+ async def paste_from_clipboard(browser: BrowserContext):
32
+ text = pyperclip.paste()
33
+ # send text to browser
34
+ page = await browser.get_current_page()
35
+ await page.keyboard.type(text)
36
+
37
+ return ActionResult(extracted_content=text)
38
+
39
+
40
+ async def main():
41
+ task = (
42
+ f'Copy the text "Hello, world!" to the clipboard, then go to google.com and paste the text'
43
+ )
44
+ model = ChatOpenAI(model='gpt-4o')
45
+ agent = Agent(
46
+ task=task,
47
+ llm=model,
48
+ controller=controller,
49
+ browser=browser,
50
+ )
51
+
52
+ await agent.run()
53
+ await browser.close()
54
+
55
+ input('Press Enter to close...')
56
+
57
+
58
+ if __name__ == '__main__':
59
+ asyncio.run(main())