getomni-ai / zerox

PDF to Markdown with vision models
https://getomni.ai/ocr-demo
MIT License
6.68k stars 363 forks source link

💬 Prompt updates #48

Open tylermaran opened 1 month ago

pradhyumna85 commented 1 month ago

@tylermaran, I am thinking that we can define a JSON which has constants like the default system prompt which both the JS and Python SDK could use this JSON to load the default system prompt. This will reduce redundancy across zerox's SDKs.

tylermaran commented 1 month ago

Hey @pradhyumna85, agreed. We could definitely have a shared prompt library. As well as some shared tests. Since it's really hard to tell how the output changes with a prompt change.

On the subject of shared code, I'm planning on writing some tests that do something like:

ex: If we ran this doc: https://github.com/getomni-ai/zerox/blob/main/examples/cs101.pdf

We could do a regex test

const bits = [
  "byte",
  "16-bit signed 2s complement integer",
  "Short",
  "32-bit signed 2s complement integer",
  "Integer",
  "64-bit signed 2s complement integer",
  "Long",
  "float",
  "32-bit IEEE 754 floating point number"
  ]

const countMatches = (text) => {
  const pattern = new RegExp(bits.join('|'), 'g');
  const matches = text.match(pattern);
  return matches ? matches.length : 0;
}