Skip to content

Commit

Permalink
outputparser: improve DefinedOutputParser (#980)
Browse files Browse the repository at this point in the history
The DefinedOutputParser prompted the LLM with a Typescript schema,
but expected a json in response: https://github.com/tmc/langchaingo/blob/1975058648b5914fdd9dc53434c5b59f219e2b5c/outputparser/defined.go\#L65-69
Now it also requests a json.
  • Loading branch information
amitaifrey authored Sep 13, 2024
1 parent ddb8293 commit f4c2abb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion outputparser/defined.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var _ schema.OutputParser[any] = Defined[any]{}

// GetFormatInstructions returns a string describing the format of the output.
func (p Defined[T]) GetFormatInstructions() string {
const instructions = "Your output should be in JSON, structured according to this TypeScript:\n```typescript\n%s\n```"
const instructions = "Your output should be in JSON, structured according to this schema:\n```json\n%s\n```"
return fmt.Sprintf(instructions, p.schema)
}

Expand Down

0 comments on commit f4c2abb

Please sign in to comment.