-
Notifications
You must be signed in to change notification settings - Fork 2
Introduce langchain based interpreter for AFM #7
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
Merged
Merged
Changes from 20 commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
d766755
Add parser implementation
RadCod3 d9fb52f
Add validation to client auth
RadCod3 ecf2e60
Add agent runtime implementation
RadCod3 5aacd22
Add agent tests
RadCod3 90360be
Refactor schema validator and remove unused variables
RadCod3 59defb4
Add webchat interface support
RadCod3 00b598b
Add consolechat interface support
RadCod3 3c36657
Add webhook interface support
RadCod3 66e68b4
Add tests for interfaces
RadCod3 d2dfb1a
Add mcp tool support
RadCod3 3ae824f
Add mcp tests
RadCod3 2e7f1ad
Add cli script to run project
RadCod3 60a179e
Add cli invoke tests
RadCod3 bde8d3d
Suppress info logs from httpx and httpcore
RadCod3 ec503b5
Fix default webchat signature to align with spec
RadCod3 f50b493
Remove snapshot from default anthropic model
RadCod3 63ea9b0
Add webui for webchat interface
RadCod3 d6f0141
Fix test failure
RadCod3 1e6066a
Address review comments
RadCod3 68d6f48
Raise exception on secret resolution failure
RadCod3 40a99cc
Add exception chaining
RadCod3 a246dda
Escape chat path before substitution
RadCod3 0f9e51a
Use exact match for markdown sections
RadCod3 dd66b43
Fix anthropic model name
RadCod3 84d6d88
Raise OutputValidationError instead of AgentError
RadCod3 0850f68
Raise TemplateEvaluationError for invalid templates
RadCod3 903fcdf
Fix async lifecycle and blocking input issues
RadCod3 4b9bb03
Expose Agent signature via public property
RadCod3 5bc3d32
Prevent sensitive error details exposure in web chat
RadCod3 62eee56
Fix signature parsing for unknown algorithm prefixes
RadCod3 7f231ca
Add exception chaining and hide internal errors in webhook
RadCod3 bcccbad
Prevent hang when HTTP server fails to start
RadCod3 ec446e1
Check extra fields in JSON Schema for http vars
RadCod3 8d7e2eb
Improve console chat with proper TUI
RadCod3 afdfd2b
Remove incorrect type hint
RadCod3 a67f3ef
Raise JSONAccessError for empty field names in JSON paths
RadCod3 e4b3322
Fix fire-and-forget task for WebSub subscription
RadCod3 f56f157
Improve styling of TUI
RadCod3 c3a0a02
Merge branch 'feat/improve-tui' into feat/langchain-py
RadCod3 8397e0b
Upgrade dependencies
RadCod3 eaafb19
Fix websub subscription not working
RadCod3 75ef205
Remove the tool call fix that was needed before
RadCod3 d9bb051
Rename project to afm-cli for publishing
RadCod3 4072517
Remove unnecessary tests and update docstring
RadCod3 f98b050
Add readme and bump version
RadCod3 b4c991b
Add ci and docker workflow
RadCod3 8ae19f7
Fix dockerfile
RadCod3 c665eec
Remove verbose docstrings
RadCod3 7d9c568
Hide logs in consolechat and add log-file flag
RadCod3 302b37e
Refactor README and pyproject
RadCod3 e2a3603
Fix verification bypassing in webhook
RadCod3 ff42321
Address review comments
RadCod3 af61d42
Add missing import
RadCod3 97c9a27
Add review suggestions
RadCod3 d637d8a
Construct WebSub callback from CLI host/port
RadCod3 4c01440
Address code review comments
RadCod3 08ff44d
Pin uv version in dockerfile
RadCod3 87b6185
Address review comments on session history, WebSub etc.
RadCod3 d76f2e2
Update readme and workflows with langchain impl
RadCod3 22c23cb
Fix double-dot path handling in templates
RadCod3 6599d76
Remove pip and pipx instructions from README
RadCod3 e96b10c
Fix image vulnerabilities
RadCod3 3c03899
Remove deadcode and unnecessary docstrings
RadCod3 b493c19
Rename project to afm
RadCod3 e2000ce
Update langchain-interpreter/src/afm/__init__.py
RadCod3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,216 @@ | ||
| # Byte-compiled / optimized / DLL files | ||
| __pycache__/ | ||
| *.py[codz] | ||
| *$py.class | ||
|
|
||
| # C extensions | ||
| *.so | ||
|
|
||
| # Distribution / packaging | ||
| .Python | ||
| build/ | ||
| develop-eggs/ | ||
| dist/ | ||
| downloads/ | ||
| eggs/ | ||
| .eggs/ | ||
| lib/ | ||
| lib64/ | ||
| parts/ | ||
| sdist/ | ||
| var/ | ||
| wheels/ | ||
| share/python-wheels/ | ||
| *.egg-info/ | ||
| .installed.cfg | ||
| *.egg | ||
| MANIFEST | ||
|
|
||
| # PyInstaller | ||
| # Usually these files are written by a python script from a template | ||
| # before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
| *.manifest | ||
| *.spec | ||
|
|
||
| # Installer logs | ||
| pip-log.txt | ||
| pip-delete-this-directory.txt | ||
|
|
||
| # Unit test / coverage reports | ||
| htmlcov/ | ||
| .tox/ | ||
| .nox/ | ||
| .coverage | ||
| .coverage.* | ||
| .cache | ||
| nosetests.xml | ||
| coverage.xml | ||
| *.cover | ||
| *.py.cover | ||
| .hypothesis/ | ||
| .pytest_cache/ | ||
| cover/ | ||
|
|
||
| # Translations | ||
| *.mo | ||
| *.pot | ||
|
|
||
| # Django stuff: | ||
| *.log | ||
| local_settings.py | ||
| db.sqlite3 | ||
| db.sqlite3-journal | ||
|
|
||
| # Flask stuff: | ||
| instance/ | ||
| .webassets-cache | ||
|
|
||
| # Scrapy stuff: | ||
| .scrapy | ||
|
|
||
| # Sphinx documentation | ||
| docs/_build/ | ||
|
|
||
| # PyBuilder | ||
| .pybuilder/ | ||
| target/ | ||
|
|
||
| # Jupyter Notebook | ||
| .ipynb_checkpoints | ||
|
|
||
| # IPython | ||
| profile_default/ | ||
| ipython_config.py | ||
|
|
||
| # pyenv | ||
| # For a library or package, you might want to ignore these files since the code is | ||
| # intended to run in multiple environments; otherwise, check them in: | ||
| # .python-version | ||
|
|
||
| # pipenv | ||
| # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
| # However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
| # having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
| # install all needed dependencies. | ||
| # Pipfile.lock | ||
|
|
||
| # UV | ||
| # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. | ||
| # This is especially recommended for binary packages to ensure reproducibility, and is more | ||
| # commonly ignored for libraries. | ||
| # uv.lock | ||
|
|
||
| # poetry | ||
| # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. | ||
| # This is especially recommended for binary packages to ensure reproducibility, and is more | ||
| # commonly ignored for libraries. | ||
| # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control | ||
| # poetry.lock | ||
| # poetry.toml | ||
|
|
||
| # pdm | ||
| # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. | ||
| # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python. | ||
| # https://pdm-project.org/en/latest/usage/project/#working-with-version-control | ||
| # pdm.lock | ||
| # pdm.toml | ||
| .pdm-python | ||
| .pdm-build/ | ||
|
|
||
| # pixi | ||
| # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control. | ||
| # pixi.lock | ||
| # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one | ||
| # in the .venv directory. It is recommended not to include this directory in version control. | ||
| .pixi | ||
|
|
||
| # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm | ||
| __pypackages__/ | ||
|
|
||
| # Celery stuff | ||
| celerybeat-schedule | ||
| celerybeat.pid | ||
|
|
||
| # Redis | ||
| *.rdb | ||
| *.aof | ||
| *.pid | ||
|
|
||
| # RabbitMQ | ||
| mnesia/ | ||
| rabbitmq/ | ||
| rabbitmq-data/ | ||
|
|
||
| # ActiveMQ | ||
| activemq-data/ | ||
|
|
||
| # SageMath parsed files | ||
| *.sage.py | ||
|
|
||
| # Environments | ||
| .env | ||
| .envrc | ||
| .venv | ||
| env/ | ||
| venv/ | ||
| ENV/ | ||
| env.bak/ | ||
| venv.bak/ | ||
|
|
||
| # Spyder project settings | ||
| .spyderproject | ||
| .spyproject | ||
|
|
||
| # Rope project settings | ||
| .ropeproject | ||
|
|
||
| # mkdocs documentation | ||
| /site | ||
|
|
||
| # mypy | ||
| .mypy_cache/ | ||
| .dmypy.json | ||
| dmypy.json | ||
|
|
||
| # Pyre type checker | ||
| .pyre/ | ||
|
|
||
| # pytype static type analyzer | ||
| .pytype/ | ||
|
|
||
| # Cython debug symbols | ||
| cython_debug/ | ||
|
|
||
| # PyCharm | ||
| # JetBrains specific template is maintained in a separate JetBrains.gitignore that can | ||
| # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
| # and can be added to the global gitignore or merged into this file. For a more nuclear | ||
| # option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
| # .idea/ | ||
|
|
||
| # Abstra | ||
| # Abstra is an AI-powered process automation framework. | ||
| # Ignore directories containing user credentials, local state, and settings. | ||
| # Learn more at https://abstra.io/docs | ||
| .abstra/ | ||
|
|
||
| # Visual Studio Code | ||
| # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore | ||
| # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore | ||
| # and can be added to the global gitignore or merged into this file. However, if you prefer, | ||
| # you could uncomment the following to ignore the entire vscode folder | ||
| # .vscode/ | ||
|
|
||
| # Ruff stuff: | ||
| .ruff_cache/ | ||
|
|
||
| # PyPI configuration file | ||
| .pypirc | ||
|
|
||
| # Marimo | ||
| marimo/_static/ | ||
| marimo/_lsp/ | ||
| __marimo__/ | ||
|
|
||
| # Streamlit | ||
| .streamlit/secrets.toml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.11 |
RadCod3 marked this conversation as resolved.
Show resolved
Hide resolved
RadCod3 marked this conversation as resolved.
Show resolved
Hide resolved
|
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| [project] | ||
| name = "langchain-interpreter" | ||
| version = "0.1.0" | ||
| description = "AFM (Agent-Flavored Markdown) interpreter using LangChain" | ||
| readme = "README.md" | ||
| authors = [ | ||
| { name = "Radith Samarakoon", email = "jjeli1234@gmail.com" } | ||
| ] | ||
RadCod3 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| requires-python = ">=3.11" | ||
| dependencies = [ | ||
| "langchain>=1.2.8", | ||
| "pyyaml>=6.0", | ||
| "pydantic>=2.0", | ||
| "langchain-openai>=1.1.7", | ||
| "langchain-anthropic>=1.3.1", | ||
| "jsonschema>=4.26.0", | ||
| "fastapi>=0.128.1", | ||
| "httpx>=0.28.1", | ||
| "uvicorn>=0.40.0", | ||
| "mcp>=1.26.0", | ||
| "langchain-mcp-adapters>=0.2.1", | ||
| "click>=8.0.0", | ||
| ] | ||
|
|
||
| [project.scripts] | ||
| afm = "langchain_interpreter.cli:main" | ||
|
|
||
| [build-system] | ||
| requires = ["uv_build>=0.9.28,<0.10.0"] | ||
| build-backend = "uv_build" | ||
|
|
||
| [tool.pytest.ini_options] | ||
| testpaths = ["tests"] | ||
| pythonpath = ["src"] | ||
| asyncio_mode = "auto" | ||
| asyncio_default_fixture_loop_scope = "function" | ||
|
|
||
| [dependency-groups] | ||
| dev = [ | ||
| "ruff>=0.15.0", | ||
| "pytest>=8.0", | ||
| "pytest-cov>=7.0.0", | ||
| "pytest-asyncio>=1.3.0", | ||
| ] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we remove irrelevant stuff?