langchaingo icon indicating copy to clipboard operation
langchaingo copied to clipboard

`outputparser.NewStructured` is restrictive & not robust enough

Open steinathan opened this issue 2 years ago • 1 comments

right now, outputparser.NewStructured is based on an internal struct (https://github.com/tmc/langchaingo/blob/main/outputparser/structured.go#L36) that's restrictive to only strings and output values, but I think it should be user-defined, a good example is from vector store here (https://github.com/tmc/langchaingo/blob/main/vectorstores/options.go#L30)

I can create a PR if this is the right way to go

Workaround

for now, I defined a custom prompt with the fields I need with a custom OutputParser and fed the prompt directly to the chain.

steinathan avatar Jul 16 '23 23:07 steinathan

Yeah I agree -- making this more flexible would be welcomed.

tmc avatar Mar 19 '24 23:03 tmc