Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[draft] plugin_fn extractors#32

Draft
fliepeltje wants to merge 8 commits intoextism:main from
fliepeltje:feat/plugin-extractors
Draft

[draft] plugin_fn extractors #32
fliepeltje wants to merge 8 commits intoextism:main from
fliepeltje:feat/plugin-extractors

Conversation

@fliepeltje
Copy link
Contributor

@fliepeltje fliepeltje commented Nov 27, 2024

This is a proof of concept of implementing extractors based on function annotation.

This works with the Config example as described. What does not work is defining an input. For example:

@extism.plugin_fn
def count_vowels(config: extism.Config, input: str) -> Count:
 ...

will raise the following error:

Error: the `wizer.initialize` function trapped
Caused by:
 0: error while executing at wasm backtrace:
 0: 0xc3d536 - core.wasm!extism_pdk::extism::load_input::ha87e3399c3e88427
 1: 0xc3da6f - core.wasm!extism_pdk::input_bytes::hb6157a98e888d918
 2: 0x99a9 - core.wasm!core::py_module::__pyfunction_input_str::h20274f6b4ee092c8
 3: 0x8e3a - core.wasm!pyo3::impl_::trampoline::trampoline::hba91026dbca8481a
 4: 0x9984 - core.wasm!core::py_module::<impl core::py_module::input_str::MakeDef>::_PYO3_DEF::trampoline::hb47a2005df801990
 5: 0x12613f - core.wasm!cfunction_vectorcall_NOARGS
 6: 0x1da1a - core.wasm!_PyObject_VectorcallTstate
 7: 0x1f06e - core.wasm!PyObject_Vectorcall
 8: 0x2d366e - core.wasm!_PyEval_EvalFrameDefault
 9: 0x2b18db - core.wasm!_PyEval_EvalFrame
 10: 0x2b129b - core.wasm!_PyEval_Vector
 11: 0x2b0f9c - core.wasm!PyEval_EvalCode
 12: 0x36b71c - core.wasm!exec_code_in_module
 13: 0x36b40f - core.wasm!PyImport_ExecCodeModuleObject
 14: 0x36b0ab - core.wasm!PyImport_ExecCodeModuleWithPathnames
 15: 0x36b4b1 - core.wasm!PyImport_ExecCodeModuleEx
 16: 0xc4f726 - core.wasm!pyo3::types::module::PyModule::from_code_bound::hee18162d729acce4
 17: 0x19d32 - core.wasm!wizer.initialize
 18: 0xc89a3b - core.wasm!wizer.initialize.command_export
 1: Error: attempted to call an unknown imported function: 'extism:host/env' 'input_length'
 
 You cannot call arbitrary imported functions during Wizer initialization.

I'd love some help with figuring out how to not have this error :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

Comments

AltStyle によって変換されたページ (->オリジナル) /