Saravanan666/pypi-org huggingface dataset:
Package: prompt-pilot
Prompt PilotDISCLAIMER: This is a work in progress, and I'm sharing it as a temporary solution with some functions that you can experiment with.Prompt Pilot is a library designed for prompt engineering in AI models. It introduces the concept of "prompt functions" to streamline the prompt creation process. With just one function, developers can create complex prompts effortlessly.Here's an example implementation for creating a digital marketing chatbot:# import the required functions from prompt_pilot.
from prompt_pilot.assistants import life_coach
from prompt_pilot.api_ai import gpt3
#import config function from decouple to read api_key
import decouple 

# use promptpilot to generate prompt
prompt = life_coach(name="Rocky")
print(prompt)

# configure your apikey
openai_api_key = decouple.config("OPENAI_API_KEY")

# use promptpilot's api call functions to pass prompt and apikey
output = gpt3(prompt=prompt, api_key=openai_api_key)
print(output)By automating both prompt engineering and API calls to AI models, Prompt Pilot significantly reduces the code required to build a chatbot. With just 5-6 lines of code, you can have a fully functional chatbot up and running in very little time.Here's what you can build with prompt-pilot:Chatbots and other NLP tasks :Personalized chatbots for business usecase, personal usecase, and academic usecase. API calls to OpenAI and LLMs on ReplicateImage models :Varying styles for image generators. API calls to image models on ReplicateData science :Automating data-science by incorporating LLMs (OpenAI) into the process to perform analysis
Package: promptr
promptr is a toolkit for building CLI shells, similar to that found on a Cisco router.The library uses a click and flask style decorator driven interface that allows you to quickly and easily build a shell.Documentationpromptr’s documentation can be found athttps://promptr.readthedocs.ioInstalling promptrpromptr can be installed from Pypi using pip:pip install promptrThanksThanks to prompt-toolkit for the underlying functionality, and thanks to pallets for the click and flask inspiration.ContributingTo contribute to promptr, please try to make sure that any new features, or changes
to existing functionalityinclude test coverage.Additionally, please format your code usingyapfwithfacebookstyle prior to issuing your pull request.yapf--style=facebook-i-rpromptr setup.py
Package: promptrix
promptrix-pyPromptrix is a prompt layout engine for Large Language Models.Here is a first trivial example:from promptrix import promptrixTypes, VolatileMemory, FunctionRegistry, GPT3Tokenizer
from promptrix.Prompt import Prompt
from promptrix.SystemMessage import SystemMessage
from promptrix.UserMessage import UserMessage
from promptrix.AssistantMessage import AssistantMessage
from promptrix.ConversationHistory import ConversationHistory

functions = FunctionRegistry()
tokenizer = GPT3Tokenizer()
memory = VolatileMemory({'input':'', 'history':[]})
max_tokens = 2000

prompt_text = 'You are helpful, creative, clever, and very friendly. '
PROMPT = Prompt([
    UserMessage(prompt_text),
    ConversationHistory('history', .5),    # allow history to use up 1/2 the remaining token budget left after the prompt and input 
    UserMessage('{{$input}}')
])

async def render_messages_completion():
    as_msgs = await PROMPT.renderAsMessages(memory, functions, tokenizer, max_tokens)
    msgs = []
    if not as_msgs.tooLong:
        msgs = as_msgs.output
    return msgs

### basic chat loop
while True:
    memory.set('input', query)
    msgs = asyncio.run(render_messages_completion())
    response = ... your favorite llm api (model, msgs, ...)
    print(response)
    history = memory.get('history')
    history.append({'role':USER_PREFIX, 'content': query})
    history.append({'role': ASSISTANT_PREFIX, 'content': response})
    memory.set('history', history)
Package: promptsdk
Manage prompts via githubUsagefrompromptSDKimportpromptsprint(prompts.my_folder.myprompt)# this expects a repo with repo/my_folder/myprompt.mdWhen your code accesses a prompt it fetches that file from your prompt repo. This allows iterating on prompts while your server is running.
Prompts are cached, so the SDK does not fetch from the web everytime you accesss a prompt. The default cache lifetime is 10 seconds for dev and 300 for productionInstallpipinstallpromptSDKSetupInformation on how to generate a token can be foundhereIf your prompt repo is public just leave the token empty.
Required env variables (see env.sample) areBASE_URL=https://github.com/username/repoTOKEN=your_github_personal_access_tokenLimitationsCurrently only supports reading .md files in the prompt repoExample Prompt Repohttps://github.com/ottozastrow/sample-prompts
Package: prompt-smart-menu
prompt_smart_menuis a library for building command line menus for terminal applications
in Python. It allows you to create a multi-tiered argument parsing menu for executing
different subcommands of a command line application.Read thedocumentation on readthedocs.DescriptionThis library is designed around parsing a command string, not command line arguments. That is,
it is intended to be used inside a python application using aninput()type interface.For command line arguments passed to the python script, a library such as argparse would be
better suited. Though this library could be used for such purpose.Though not required, this library was designed to augment theauto-completionfeature ofPython Prompt Toolkit. Theprompt_toolkitlibrary is very powerful, check it out!FeaturesDeclarative interface(That’s why I built this :] )Integration withprompt_toolkit auto-completionSupport for python keyword arguments.Different parsers for type casting arguments (e.g. numbers).Ability to build custom argument parser.Argument validation for endpoint functions.Flexibility to mix options (e.g. parsers) for different subcommands.No dependencies, thoughprompt_toolkithighly recommended.Installationpip install prompt_smart_menuGetting startedSee documentation onreadthedocs.
Package: promptsmiles
PromptSMILES: Simple scaffold decoration and fragment linking for chemical language modelsThis library contains code to manipulate SMILES strings to facilitate iterative prompting to be coupled with a trained chemical language model (CLM) that uses SMILES notation.InstallationThe libary can be installed via pippip install promptsmilesOr via obtaining a copy of this repo, promptsmiles requires RDKit.git clone https://github.com/MorganCThomas/PromptSMILES.git
cd PromptSMILES
pip install ./UsePromptSMILES is designed as a wrapper to CLM sampling that can accept a prompt (i.e., an initial string to begin autoregressive token generation). Therefore, it requires two callable functions, described later. PromptSMILES has 3 main classes, DeNovo (a dummy wrapper to make code consistent), ScaffoldDecorator, and FragmentLinker.Scaffold DecorationfrompromptsmilesimportScaffoldDecorator,FragmentLinkerSD=ScaffoldDecorator(scaffold="N1(*)CCN(CC1)CCCCN(*)",batch_size=64,sample_fn=CLM.sampler,evaluate_fn=CLM.evaluater,batch_prompts=False,# CLM.sampler accepts a list of prompts or notshuffle=True,# Randomly select attachment points within a batch or notreturn_all=False,)smiles,nlls=SD.sample(batch_size=3,return_all=True)# Parameters can be overriden here if desiredFragment linking / scaffold hoppingFL=FragmentLinker(fragments=["N1(*)CCNCC1","C1CC1(*)"],batch_size=64,sample_fn=CLM.sampler,evaluate_fn=CLM.evaluater,batch_prompts=False,shuffle=True,scan=False,# Optional when combining 2 fragments, otherwise is set to truereturn_all=False,)smiles,nlls=FL.sample(batch_size=3)Required chemical language model functionsNotice the callable functions required CLM.sampler and CLM.evaluater. The first is a function that samples from the CLM given a prompt.defCLM_sampler(prompt:Union[str,list[str]],batch_size:int):"""Input: Must have a prompt and batch_size argument.Output: SMILES [list], NLLs Union[list, np.array, torch.tensor](CPU w.o. gradient)"""# Encode prompt and sample as per model implementationreturnsmiles,nllsNote: For a more efficient implementation, prompt should accept a list of prompts equal to batch_size andbatch_promptsshould be set toTruein the promptsmiles class used.The second is a function that evaluates the NLL of a list of SMILESdefCLM_evaluater(smiles:list[str]):"""Input: A list of SMILESOutput: NLLs [list, np.array, torch.tensor](CPU w.o. gradient)"""returnnlls
Package: prompt-toolkit2
This package is simply a renamed version of the v2.0 branch of the [prompt_toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit/tree/2.0) package. The intent here is
that you can install prompt_toolkit and prompt_toolkit2 into the same venv/interpreter at the same time. You can then stay on v2 by renaming all yourimport prompt_toolkitimports
toimport prompt_toolkit2.Note that it is almost certainly impossible to pass objects between v2 and v3 branches of prompt_toolkit so don’t try using this to make some sort of hybrid use of the libraries.
I haven’t tested importing prompt_toolkit v3 and prompt_toolkit2 into the same process but I don’t know why you would want to do that in the first place. They probably won’t interfere
with each other though so if you have to import both in the same interpreter it might work ok.The source code is unchanged from the v2 branch aside from the mechanical renaming. There were two unreleased bug fixes from 2019 in the branch so maybe that’ll help you out a bit.
I don’t think anyone expects more maintenance work done on the v2 branch of prompt_toolkit so this is probably going to be the last release of prompt_toolkit2. Tests are passing in
Python 2 and Python 3.9+ interpreters.
Package: prompt-toolkit-action-completer
Action CompleterA fairly simple method for registering callables as prompt-toolkit completions.This package provides the basic features to easily construct a custom completer using
decorators to reduce the amount of boilerplate needed to build basic tooling throughprompt-toolkit.
A quick example is provided below, but if you are interested in the available features
and patterns you should read throughthe documentation.This is a project that I originally created for myself several times when building
personal utilities with prompt-toolkit, and figured it might be useful for other people
to eventually use or extend.
As a side-effect of this being a personal utility, the provided functionality may notexactlyfit what you are looking for and the provided tests do not check all edge
cases properly yet.frompathlibimportPathfromaction_completerimportActionCompleterfromprompt_toolkit.shortcutsimportpromptfromprompt_toolkit.completionimportPathCompleterfromprompt_toolkit.validationimportValidatorcompleter=ActionCompleter()@completer.action("cat")@completer.param(PathCompleter(),cast=Path,validators=[Validator.from_callable(lambdap:Path(p).is_file(),error_message="Path is not an existing file")])def_cat_action(filepath:Path):withfilepath.open("r")asfile_handle:print(file_handle.read())prompt_result=prompt(">>> ",completer=completer,validator=completer.get_validator())completer.run_action(prompt_result)
Package: prompt-tr-free
prompt-tr-freePrompt translate for free: be gentle and rate-limit to 3 calls/2 seconds, first 200 calls exemptedInstallationpip install -U prompt-tr-freeorInstall (pip or whatever) necessary requirements, e.g.pip install requests fuzzywuzzy pytest jmespath coloredlogsorpip install -r requirements.txtDrop the file prompt_tr.py in any folder in your PYTHONPATH (check with import sys; print(sys.path)or clone the repo (e.g.,git clone https://github.com/ffreemt/prompt-tr-free.gitor downloadhttps://github.com/ffreemt/prompt-tr-free/archive/master.zipand unzip) and change to the prompt-tr-free folder and do apython setup.py developLimitationprompt_tr('hello world', 'en', 'zh')does not seem to work (would result in 'hello world'!).Usagefrom prompt_tr import prompt_tr

print(prompt_tr('hello world', to_lang='de'))  # ->'hallo Welt'
print(prompt_tr('hello world', to_lang='fr'))  # ->'bonjour monde'
print(prompt_tr('hello world', to_lang='ja'))  # ->'ハロー・ワールド'
print(prompt_tr('世界您好', to_lang='ja'))  # ->'ハロー・ワールド'
print(prompt_tr('世界您好', to_lang='en'))  # ->'Hello world'
print(prompt_tr('Dies sein teste', to_lang='zh'))  # ->'这是测试'Languages supported: ar, ca, zhcn, nl, fi, fr, de, el, he, hi, it, ja, kk, ko, pt, ru, es, tr, uk.
Consult the official website for details.AcknowledgmentsThanks to everyone whose code was used
Package: promptware
Software 3.0 - PromptwareInstallFor common userspipinstallpromptwareFor developersgitclonehttps://github.com/ExpressAI/Promptware.gitcdPromptware# Install the required dependencies and dev dependenciespipinstall-e.Quick ExampleexportOS_API_KEY=YOUR_OPENAI_KEYfrompromptwareimportinstallsoftware=install("sentiment_classifier")label=software.execute({"text":"I love this movie"})orimportpromptwareaspopsoftware=pop.install("sentiment_classifier")label=software.execute({"text":"I love this movie"})or install a software locallyfrompromptwareimportinstallsoftware=install("./softwares/sentiment_classifier")label=software.execute({"text":"I love this movie"})it also supports subconfig:frompromptwareimportinstallsoftware=install("./softwares/machine_translation","enzh")software=install("./softwares/machine_translation","zhen")See more in thisexampleAdd More SoftwaresHere is oneexample, where you need to create two files:sentiment_classifier: declare different configs of the softwaresentiment_classifier_test: a test file for your defined softwareyou can run the test file with following script:python-munittestsoftwares.sentiment_classifier.sentiment_classifier_testSchema of Promptware@dataclassclassPromptware:# Namename:str# Describe what the promptware is designed fordescription:str# Instruction text of promptwareinstruction:str|Callable[[Any],str]# Demonstration of promptwaredemonstration:Optional[list[str]]# Prompt template defines how a user's input will be formattedprompt_template:Callable[[Any],str]# The most appropriate tasks that the promptware could be applied totask:TaskType
Package: promptwatch
PromptWatch.io ... session tracking for LangChainIt enables you to:track all the chain executionstrack LLM Prompts andre-play the LLM runswith the same input parameters and model settings to tweak your prompt templatetrack your costs perprojectand pertenant(your customer)InstallationpipinstallpromptwatchBasic usageIn order to enable session tracking  wrap you chain executions in PromptWatch blockfromlangchainimportOpenAI,LLMChain,PromptTemplatefrompromptwatchimportPromptWatchprompt_template=PromptTemplate.from_template("Finish this sentence{input}")my_chain=LLMChain(llm=OpenAI(),prompt=prompt_template)withPromptWatch(api_key="<your-api-key>")aspw:my_chain("The quick brown fox jumped over")Here you can get your API key:http://www.promptwatch.io/get-api-key(no registration needed)You can set it directly intoPromptWatchconstructor, or set is as anENV variablePROMPTWATCH_API_KEYComprehensive Chain Execution TrackingWith PromptWatch.io, you can track all chains, actions, retrieved documents, and more to gain complete visibility into your system. This makes it easy to identify issues with your prompts and quickly fix them for optimal performance.What sets PromptWatch.io apart is its intuitive and visual interface. You can easily drill down into the chains to find the root cause of any problems and get a clear understanding of what's happening in your system.Read more here:Chain tracing documentationLLM Prompt cachingIt is often tha case that some of the prompts are repeated over an over. It is costly and slow.
With PromptWatch you just wrap your LLM model into our CachedLLM interface and it will automatically reuse previously generated values.Read more here:Prompt caching documentationLLM Prompt Template TweakingTweaking prompt templates to find the optimal variation can be a time-consuming and challenging process, especially when dealing with multi-stage LLM chains. Fortunately, PromptWatch.io can help simplify the process!With PromptWatch.io, you can easily experiment with different prompt variants by replaying any given LLM chain with the exact same inputs used in real scenarios. This allows you to fine-tune your prompts until you find the variation that works best for your needs.Read more here:Prompt tweaking documentationKeep Track of Your Prompt Template ChangesMaking changes to your prompt templates can be a delicate process, and it's not always easy to know what impact those changes will have on your system. Version control platforms like GIT are great for tracking code changes, but they're not always the best solution for tracking prompt changes.Read more here:Prompt template versioning documentationUnit testingUnit tests will help you understand what impact your changes in Prompt templates and your code can have on representative sessions examples.Read more here:Unit tests documentation
Package: promptwithoptions
PromptWithOptionsCommand line input with options for PythonExamplefrompromptwithoptionsimport(set_prompt_defaults,promptwithoptions,)clr_yellow="\u001b[33m"clr_l_green="\u001b[32;1m"clr_blue="\u001b[34m"clr_l_blue="\u001b[34;1m"my_options=('one','two','three')set_prompt_defaults(options_line_color=clr_yellow,options_number_color=clr_l_green,input_line_color=clr_blue,confirm_line_color=clr_l_blue)promptwithoptions('How many',options=my_options,default=1,show_confirmation=True)Available settingsThese are all optional named arguments (in this order) ofset_prompt_defaultsandpromptwithoptions.prompt: prompt string - this appears as a question with a?appended as long ashide_questionmark is not Trueoptions: list of available options, without thisdata_type: a callable that raises an exception if the input is invalid (e.g.int,bool)default: default in case of empty inputallow_empty: boolean, if True then prompt doesn't repeat with empty inputallow_multiple: boolean, if True then comma-separated values are accepted and the return value is always a list (in fact atuple)allow_repetitive: boolean, if True then the same values can be added multiple times - only considered ifallow_multiple is Trueshow_confirmation: boolean, if True then the accepted input is reprinted with the selected option (if options are given)hide_key: boolean, if True the first item of each option doesn't get printed on the screen (if an option has multiple items like keys and values)hide_questionmark: boolean, if True then '?' is not attached to prompt text (neither a ':' to the confirmation if shown)hide_mandatory_sign: boolean, if True then '*' doesn't appear after the question ifallow_empty is not Truehide_multiple_choice_sign: boolean, if True then '…' doesn't appear after the question ifallow_multiple is Trueno_interaction: boolean, if True default is applied automatically (if given) and no input is required (this is to apply--yes)options_line_color: if given, options are displayed as a numbered list - this is the colour of the list itemsoptions_number_color: if given, options are displayed as a numbered list - this is the colour of the numbersinput_line_color: as isconfirm_line_color: as isSetting and resetting defaultsset_prompt_defaults()can be called multiple times.A default value can be removed (set back to None) when_None_is passed down likeset_prompt_defaults(allow_empty="_None_").
Argument defaults can be removed at once by callingreset_defaults(from promptwithoptions import reset_defaults).Options listIt's a plain list of strings, a list of keys and values or a dict.If there are keys and values only a key is returned at the end. In that case keys can be stopped from printing byhide_key.Multiple ChoiceWhenallow_multiple is Truethen multiple values can be added if separated by,s.
Commas can be escaped by quotation marks similarly to CSV escape rules.Entering empty value when default is givenUse '-' to explicitely get empty even when default is given andallow_empty=True.Escape it as'-'if you need a literal hyphen.
Package: prompt-wrangler
Prompt WranglerA Python wrapper for thePrompt WranglerREST API.Easily integrate large language models (LLMs) into your app with Prompt Wrangler! Prompt Wrangler makes it simple to incorporate LLMs into your application and enhance your prompts without updating your code. Best of all, it's 100% free!InstallationInstall the package using pip:pipinstallprompt-wranglerEnvironment VariablesBefore you need to set environment variables.If you want to use private prompts from your workspace you should set:PROMPT_WRANGLER_API_KEY=<your_api_key>If you want to use public prompts from the community you should set:OPENAI_API_KEY=<open_ai_api_key>Note that if you set yourPROMPT_WRANGLER_API_KEYyou don't need to setOPENAI_API_KEYas it will be used as a fallback.Usagefromprompt_wranglerimportPromptWrangler# Create a PromptWrangler instancepw=PromptWrangler()# Get a promptprompt_path="my-workspace/my-prompt-slug"prompt=prompt_wrangler.prompt(prompt_path)# Run the promptargs={'input_text':'some input'}result=prompt.run(args=args)prediction=result.predictionLicenseThis project is licensed under the MIT License.Local DevelopmentPublishRun. Username is exit38./publish.sh
Package: promptx
PromptXWhether you use dmenu, fzf, or rofi, PromptX gives you complete access
to your favorite prompt program. As simple or complex as you like the
choice is yours.InstallationThe usual way:pip install promptxRequires python3UsageInitializationWithout default args:>>>p=PromptX("dmenu")With default args:>>>p=PromptX(prompt_cmd="dmenu",default_args="-l 20 -i")What's the difference?Well, if you initialize thePromptXobject with default args they get
included every time you use theask()method. This is nice if you
always want your prompt to look a certain way despite the question.p.ask()At it's most basic:>>>choices=["1","2","3"]>>>response=p.ask(choices)>>>print(response)'1'But there are some additional arguments thatask()takes. Here they
are in positional order.options(List)A list of options to present the user with. Not optional.prompt(Optional[str])The prompt to use when querying the user. The necessary flag will get
automatically added based on the prompt command used to initializePromptX.additional_args(Optional[str])Add additional arguments to the prompt command. Any additional arguments
will get added before the prompt flag. These arguments must be a string.
They will be appropriately split, just provide them as you would from
the command line.select(Optional[str])User's may select multiple answers in any of the three supported prompt
commands. The default is to return the first selection they made. Here
are the options to change this behavior and the return type ofask():"first": Default Use "first" if you want the first option the user
selected. Returns a string."last": Use "last" if you want the last option the user selected.
Returns a string."all": Use "all" if you want all options the user selected. Returns a
list of all selected options.deliminator(Optional[str])Default is "". This is the deliminator to use when joining your list of
options.p.add_args()If you don't like that ask requires a string to add additional args then
use this method with a list.additional_args(List):These args will get added to thePromptXobject. By default these
arguments are not sticky, meaning they do not change the default args
that the object got initialized with.default_args(Optional[bool])If you want these arguments to get added to the default args then set
this toTrue.