Completion (OpenAI / GPT-Compatible)
This plugin mainly enables you to integrate services that are compatible with older OpenAI completion or instruction templates.
Setting up your agent
- After setting up your system, navigate to the "Add Panel" section and select your LLM Completion plugin.
- Choose your desired model from the list of available options (as needed, depending on your endpoint - many times, unneeded).
- Set the
Context Size
for the model which you are connecting to. - Set your
API Key
(often can just beplaceholder
, or something similar) andBase URL
for your API endpoint as needed. - Set a
System Message
, this will help guide your model if you'd like it to behave a certain way or do something specific. - Update your
Prompt Template
to reflect the structure your model is expecting (Jinja formatted).
Once you've added your API key, your agent will be ready to use!
Jinja Templating
You can read up more on Jinja templating to customize the exact string which is sent to the language model for completion.
The default format looks like the following:
## SYSTEM: {{ system_message }}
{% if document_context != "" %}
## DOCUMENT CONTENT: {{ document_content }}
{% endif %}
## MESSAGE HISTORY:
{% for message in message_history %}
{% if message.role == "user" %}
USER: {{ message.content }}
{% elif message.role == "assistant" %}
ASSISTANT: {{ message.content }}
{% endif %}
{% endfor %}
## RESPONSE:
Document upload ( and /append
command)
This plugin allows you to upload text-based documents (e.g., .txt, .doc, .md) to enhance your chat experience.
The plugin will:
- Convert your uploaded files into plain text.
- Store these text versions for your AI model to access.
When you want to use your document when chatting:
- Use the
/append
command in your chat - Followed by your document(s) filename(s)
/file filename.pdf
- And then any additional questions you have to add the documents to your context when chatting.
An example prompt with the command would look like:
/append /file filename.pdf What are the core themes I should be aware of in this document?
Note on longer context
If your document is too large to fit within your chosen model's context window it will be excluded from your message context and you will receive a warning.
For larger documents, consider using our Document Lookup (RAG) agent plugin.
Review the code
Want to review how this model is made, or use it as the base to creating a new agent plugin?
You can find the code that powers this plugin available here:
https://github.com/promptpanel/promptpanel/tree/main/plugins/completion_chat