-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Labels
bugSomething isn't workingSomething isn't workingcore pluginAnything related to core pluginsAnything related to core pluginspythonPull requests for the Python Semantic KernelPull requests for the Python Semantic Kernel
Description
Describe the bug
When I add plugin to kernel via kelnel.add_plugin()
, the loading of prompt files from skprompt.txt
file will fail with UnicodeDecodeError
error
To Reproduce
Steps to reproduce the behavior:
- in
plugins/attachment/asr_test_analysis/
folder, I have 2 files. One is the prompt fileskprompt.txt
, the other is theconfig.json
file indicating the function configuration like input variables, etc. - In my program, add this
attachment
plugin via:
prompt_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "plugins")
kernel.add_plugin(
parent_directory=prompt_dir,
plugin_name="attachment",
)
- See error:
----
File "C:\Users\dilin\Documents\workspace\SPEECH\car_agent\speech_car\agent_for_car\venv\Lib\site-packages\semantic_kernel\functions\kernel_function_from_prompt.py", line 395, in from_directory
prompt_template_config.template = prompt_file.read()
^^^^^^^^^^^^^^^^^^
File "C:\Users\dilin\AppData\Local\anaconda3\Lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1938: character maps to <undefined>
- We use a workaround to set
PYTHONUTF8
to bypass this issue. But we are hoping that the issue can be resolved from the semantic kernel side.
Expected behavior
When semantic kernel loads the prompt file, it should open it with encoding setting utf-8
.
Platform
- Language: Python
- Source: pip package version 1.29.0
- AI model: gpt-4o
- IDE: VS Code
- OS: Windows
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcore pluginAnything related to core pluginsAnything related to core pluginspythonPull requests for the Python Semantic KernelPull requests for the Python Semantic Kernel
Type
Projects
Status
No status