Simple demo function using LangChain
The only function implemented in this module is magic.
magic works as a decorator. It simply sends the function's signature and docstring to the LLM and expects to get a result.
It can be installed with pip install magic-decorator and used with from magic_decorator import magic.
from langchain import SomeLLMModels
llm = SomeLLMModels()
from magic_decorator import magic
@magic(llm=llm)
def transpose(matrix: list[list[int]]) -> list[list[int]]:
"""
This function finds the transpose of the given matrix.
"""
transpose([[1,2,3],[4,5,6]])
[[1, 4], [2, 5], [3, 6]]
from magic_decorator import magic
@magic(llm=llm)
def add(a: float, b: float) -> float:
"""
This function adds a and b.
"""
add(1., 10.)
11.0
from magic_decorator import magic
@magic(llm=llm)
def friend(message: str) -> str:
"""
This function responds like a friend.
"""
friend("Hi, how are you today?")
'Hey! I am doing great, thank you. How about you?'
Added a decorator for langchain. In this case, it becomes LLMChain.
llm = SomeLLMModels()
@magic_langchain(llm=llm)
def mychain(arg1: int, arg2: str):
...
mychain.predict(arg1=2, arg2="hi")
There is no preprocessing, no postprocessing, and no error handling in this module. It's just code to do a simple thing, so there are no prompts to encourage better answers.
Metadata
Release files for magic-decorator 0.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| magic_decorator-0.0.12.tar.gz | 4.6 kB | Without provenance | Details for magic_decorator-0.0.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| magic_decorator-0.0.12-py3-none-any.whl | Python 3 | none | any | Details for magic_decorator-0.0.12-py3-none-any.whl |
Total release size: 8.6 kB
Release files / magic_decorator-0.0.12.tar.gz
| Download URL | magic_decorator-0.0.12.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5bf90bd79ce8c39f760fe6fa6d7d03571e260ccaf3a69380ac55297da8faa199
|
|
BLAKE2b-256 checksum How to use checksums |
9555395570f4ae5a6d64901633131f31fa67f7e481e4d0951e1f6dbe2f04d8c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / magic_decorator-0.0.12-py3-none-any.whl
| Download URL | magic_decorator-0.0.12-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a0e718760071f27328309362458da782d02534a4895adf13fc282a8ddd37255
|
|
BLAKE2b-256 checksum How to use checksums |
e90f537c9570527faa0bd73f88323723a9d5ae7dd863a4bc225234e44bfaf5bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for magic-decorator 0.0.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.