Skip to main content

No project description provided

Project description

LLM Few Shot Gen

PyPI - Version PyPI - Python Version


[!WARNING]
This library is not maintained anymore. Checkout the new project llm-prompting-gen.

Installation

pip install llm-few-shot-gen

What is LLM Few Shot Generator?

Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not. However, fine-tune them is not always possible or too expansive. In-context learning like Few Shot learning tries to solve this problem. Based on a few number of examples within the prompt a specific output can be obtained. This llm-few-shot-gen library enables few shot learning in a convenient way.

How can I use it?

The core functionality is the generators module. The class PromptEngineeringGenerator defines all requirements for a LLM to generate text based on prompt engineering techniques. If you want your output to be parsed into an pydantic dataclass checkout the class ParsablePromptEngineeringGenerator.

How to customise the class for my own use case?

The class PromptEngineeringGenerator contains two core parts 1. LLM 2. prompt engineering dataclass. If you want to initialise the generator class for you custom use case, you need to define a prompt engineering JSON file matching the format of llm_few_shot_gen.models.prompt_engineering.PromptElements.

The JSON file can contain the following prompt elements in any combination tailored to your use case:

Role: The role in which the LLM should respond

Instruction: The task of the LLM

Context: Context with relevant information to solve the task

Output Format: Description how the LLM output format should look like

Few Shot Examples: Few shot examples with optional introduction

Input: Target which the LLM should execute the task on. Could be for example a user question, or a text block to summarize.

Showcases

License

llm-few-shot-gen is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_few_shot_gen-0.1.2.tar.gz (14.3 kB view hashes)

Uploaded Source

Built Distribution

llm_few_shot_gen-0.1.2-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page