Skip to content
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

predict_and_parse is depracated #61

Open
rsher60 opened this issue Jan 30, 2024 · 2 comments
Open

predict_and_parse is depracated #61

rsher60 opened this issue Jan 30, 2024 · 2 comments

Comments

@rsher60
Copy link

rsher60 commented Jan 30, 2024

chain = create_extraction_chain(llm, schema, encoder_or_encoder_class='json')
output = chain.predict_and_parse(text="please add 15 more units sold to 2023")['data']

printOutput(output)

Running this code block throws a TypeError : initial_value must be str or None, not dict.

I was able to get output in json format using:

chain.predict(text=text)["data"]
@bhaswata08
Copy link

bhaswata08 commented Jan 30, 2024

Kind of a hacky way but do this:

chain = create_extraction_chain(llm, person_schema)
text = ## The text you want ##
output = chain.run(text=text)["data"]

@gkamradt
Copy link
Owner

Hate to say this but here are two external resources that should help

https://python.langchain.com/docs/use_cases/extraction#option-2-parsing
https://python.langchain.com/docs/modules/model_io/output_parsers/types/pydantic

I will do an overhaul of the files here in a few weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants