langchain/libs/partners/prompty
2024-11-01 20:35:55 +00:00
..
langchain_prompty community: avoid double templating in langchain_prompty (#25777) 2024-08-28 18:18:18 -04:00
scripts multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
tests multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
.gitignore prompty: adding Microsoft langchain_prompty package (#21346) 2024-05-11 04:03:44 +00:00
LICENSE prompty: adding Microsoft langchain_prompty package (#21346) 2024-05-11 04:03:44 +00:00
Makefile standard-tests[patch]: add Ser/Des test 2024-09-04 10:24:06 -07:00
poetry.lock many: use core 0.3.15 (#27834) 2024-11-01 20:35:55 +00:00
pyproject.toml many: use core 0.3.15 (#27834) 2024-11-01 20:35:55 +00:00
README.md prompty: adding Microsoft langchain_prompty package (#21346) 2024-05-11 04:03:44 +00:00

langchain-prompty

This package contains the LangChain integration with Microsoft Prompty.

Installation

pip install -U langchain-prompty

Usage

Use the create_chat_prompt function to load prompty file as prompt.

from langchain_prompty import create_chat_prompt

prompt = create_chat_prompt('<your .prompty file path>')

Then you can use the prompt for next steps.

Here is an example .prompty file:

---
name: Basic Prompt
description: A basic prompt that uses the GPT-3 chat API to answer questions
authors:
  - author_1
  - author_2
model:
  api: chat
  configuration:
    azure_deployment: gpt-35-turbo
sample:
  firstName: Jane
  lastName: Doe
  question: What is the meaning of life?
  chat_history: []
---
system:
You are an AI assistant who helps people find information.
As the assistant, you answer questions briefly, succinctly, 
and in a personable manner using markdown and even add some personal flair with appropriate emojis.

{% for item in chat_history %}
{{item.role}}:
{{item.content}}
{% endfor %}


user:
{{input}}