3.2.24 - 3.4.24
add openai key to env var:
myenv.bat
- orig.ipynb: the original book intro.ipynb fro the DSPY repo
- mimic-1.ipynb: stripping out the code cells
- mimic-2.ipynb: focusing on building a compiled rag and exporting/importing it
- infer.py - dspy signatures, inference object, command line
- server.py - basic flask server
- client.py - basic flask client for infer/ endpoint
- opt.py - export a compiled rag to a file (to be loaded by infer.py)
- Run the server and client:
python server.py
python client.py
- Run simple inference:
Use the cli args in
infer.py
to get a completion without a to a commandline question server. Will default to sigtype='basicqa'
python infer -q "What is the largest city in the United States?"
Other ways of calling it allow loading from a file, or using a different sig_type.
python -d hotpot1 --basicrag
- Fancy Inference:
Demonstrate progressive use of sig_type
'basicqa'
, 'basiccot'
, to get an answer correctly:
>python infer.py -q "What is the nationality of the chef and restaurateur featured in Restaurant: Impossible?" --basicqa
Question: What is the nationality of the chef and restaurateur featured in Restaurant: Impossible?
# Answer: American (incorrect)
>python infer.py -q "What is the nationality of the chef and restaurateur featured in Restaurant: Impossible?" --basiccot
Question: What is the nationality of the chef and restaurateur featured in Restaurant: Impossible?
# Answer: British (correct, is actually "English")
Demonstrate progressive use of sig_type
'basicqa'
, 'basiccot'
, 'basicrag'
to get an answer correctly:
python infer.py -q "Who acted in the shot film The Shore and is also the youngest actress ever to play Ophelia in a Royal Shakespeare Company production of \"Hamlet.\" ?" --basicqa
# Answer: Ciarán Hinds (incorrect)
python infer.py -q "Who acted in the shot film The Shore and is also the youngest actress ever to play Ophelia in a Royal Shakespeare Company production of \"Hamlet.\" ?" --basiccot
# Answer: Saoirse Ronan (incorrect)
python infer.py -q "Who acted in the shot film The Shore and is also the youngest actress ever to play Ophelia in a Royal Shakespeare Company production of \"Hamlet.\" ?" --basicrag
# Answer: Kerry Condon (correct)