-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Langchain::Prompt.load_from_path fails when loading yaml #407
Comments
@johnknapp Are you able to share the yaml file you're trying to load? I've never seen this issue before! |
Here you go @andreibondarev, the yaml is attached (inside a zip because I couldn't attach the yaml :-/). As an FYI, I'm also attaching the json version which loaded fine. Working from code samples on the main README, running these three commands produced the error trace as seen above.
Note that I generated the yaml file by changing the file extension from |
By the way, I just tried with an irb shell and got the same error. |
@johnknapp I had noticed that your prompt looks like the following: ---
:_type: prompt
:input_variables:
- adjective
- content
:template: Tell me a {adjective} joke about {content}. I was able to get it running if I modified the keys: ---
_type: prompt
input_variables:
- adjective
- content
template: Tell me a {adjective} joke about {content}. |
That's interesting @andreibondarev, and it makes sense considering the psych error. This sounds like a problem with the prompt.save method eh? |
Well,
But I don't know why / how that code is symbolizing the keys. |
This is my first project using lanchain-rb and I am so glad to leave python on the shelf for now!
Anyway,
prompt = Langchain::Prompt.load_from_path(file_path: 'prompts/foo.yaml')
is failing with error
/gems/psych-5.1.1.1/lib/psych/class_loader.rb:99:in find': Tried to load unspecified class: Symbol (Psych::DisallowedClass)
The failure is caused by a security fix in psych gem (prohibiting symbols) so you may want to do something with your gemspec or whatever. (By the way, adding psych to my Gemfile backdated to 4.0.1 and requiring it didn't solve my langchain-rb issue. (that's what psych issues for this error recommend))
I'll need to use json for now but would prefer to use yaml.
The trace is below.
The text was updated successfully, but these errors were encountered: