Skip to content

Commit

Permalink
add health-data-parser tag to vision parser
Browse files Browse the repository at this point in the history
  • Loading branch information
GwonHyeok committed Feb 19, 2025
1 parent bd1656c commit a4da67b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/health-data/parser/vision/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ export class GoogleVisionParser extends BaseVisionParser {
date: HealthCheckupSchema.shape.date,
name: HealthCheckupSchema.shape.name
}));
const {date, name} = await messages.pipe(llm.withStructuredOutput(DateNameSchema, {method: 'functionCalling'}))
const {
date,
name
} = await messages.pipe(llm.withStructuredOutput(DateNameSchema, {method: 'functionCalling'}).withConfig({
runName: 'health-data-parser',
metadata: {input: options.input}
}))
.withRetry({stopAfterAttempt: 3})
.invoke(options.input)

Expand Down
3 changes: 3 additions & 0 deletions src/lib/health-data/parser/vision/ollama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export class OllamaVisionParser extends BaseVisionParser {
const messages = options.messages || ChatPromptTemplate.fromMessages([]);
const chain = messages.pipe(llm.withStructuredOutput(HealthCheckupSchema, {
method: 'functionCalling',
}).withConfig({
runName: 'health-data-parser',
metadata: {input: options.input}
}))
return await chain.withRetry({stopAfterAttempt: 3}).invoke(options.input);
}
Expand Down
3 changes: 3 additions & 0 deletions src/lib/health-data/parser/vision/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export class OpenAIVisionParser extends BaseVisionParser {
const messages = options.messages || ChatPromptTemplate.fromMessages([]);
const chain = messages.pipe(llm.withStructuredOutput(HealthCheckupSchema, {
method: 'functionCalling',
}).withConfig({
runName: 'health-data-parser',
metadata: {input: options.input}
}))
return await chain.withRetry({stopAfterAttempt: 3}).invoke(options.input);
}
Expand Down

0 comments on commit a4da67b

Please sign in to comment.