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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file llm_few_shot_gen-0.1.2.tar.gz.

File metadata

  • Download URL: llm_few_shot_gen-0.1.2.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.24.1

File hashes

Hashes for llm_few_shot_gen-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a2aa4d1c8e500ae64efeb14d883eb802340393d8556a60dc7beddb2daa6335b4
MD5 d9e506dfa7391105baeead67e3c11d19
BLAKE2b-256 f608415a506c47b95c0343f07e6efd8147f7b615884f2ba7bce780c4441a2b25

See more details on using hashes here.

File details

Details for the file llm_few_shot_gen-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_few_shot_gen-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d503c4aa2517af00a0432f72d2ac6487e65b8ff1e840ab0c23935bf78576d0ce
MD5 5cc1a9f7e4d5d14c8432b028d50c7bab
BLAKE2b-256 83766d4cccac2b375557cc76c8a8db3ca09fb1a020c2bf76f34d14dd7119dcc8

See more details on using hashes here.

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