This directory contains a Jupyter notebook and a Python script that demonstrate in-context learning using LLMs. The script prompts the user for a context and a question based on that context, and then uses an LLM model to generate an answer to the question.
Read more about In-context learning in our blog.
Image Source - http://ai.stanford.edu/blog/understanding-incontext/
Image Source: https://paperswithcode.com/task/question-answering
- Clone this repository.
- Modify the config.yaml to update the
LLMQnA
component with your credentials and model - Run the LLMQnA.py to see the the In-context learning module in action.
To use the script, run the process_watsonx_request
function. You will be prompted to enter a context and a question. The context should be a paragraph or two describing a situation or concept. The question should be something that can be answered based on the provided context.
Here's an example interaction:
>>> process_watsonx_request()
Please enter the context: DataOps is a collaborative data management discipline that focuses on end-to-end data management and the elimination of data silos...
Please enter your question: What are the benefits of DataOps?
The script will generate an answer like:
DataOps offers several benefits including decreasing the cycle time in deploying analytical solutions, lowering data defects, reducing the time required to resolve data defects, and minimizing data silos.
This script requires Python 3.6 or later, and the requests
and json
libraries.