prompthub
所属分类:自然语言处理
开发工具:GO
文件大小:56KB
下载次数:0
上传日期:2023-06-07 10:48:30
上 传 者:
sh-1993
说明: 提示中心,,
(prompthub,,)
文件列表:
Dockerfile (531, 2023-07-06)
LICENSE (11357, 2023-07-06)
api (0, 2023-07-06)
api\api.go (2851, 2023-07-06)
api\errors.go (1416, 2023-07-06)
api\prompt.go (487, 2023-07-06)
go.mod (905, 2023-07-06)
go.sum (48307, 2023-07-06)
index (0, 2023-07-06)
index\index.go (1850, 2023-07-06)
index\prompt.go (390, 2023-07-06)
main.go (1700, 2023-07-06)
output (0, 2023-07-06)
output\output.go (614, 2023-07-06)
prompthub.yaml.example (77, 2023-07-06)
prompts (0, 2023-07-06)
prompts\deepset-conditioned-question-generation.md (6727, 2023-07-06)
prompts\deepset-conditioned-question-generation.yaml (325, 2023-07-06)
prompts\deepset-conversational-agent-without-tools.md (1188, 2023-07-06)
prompts\deepset-conversational-agent-without-tools.yaml (323, 2023-07-06)
prompts\deepset-conversational-agent.md (1236, 2023-07-06)
prompts\deepset-conversational-agent.yaml (1758, 2023-07-06)
prompts\deepset-conversational-summary.yaml (379, 2023-07-06)
prompts\deepset-few-shot-hotpot-qa.md (0, 2023-07-06)
prompts\deepset-few-shot-hotpot-qa.yaml (3493, 2023-07-06)
prompts\deepset-language-detection.md (1163, 2023-07-06)
prompts\deepset-language-detection.yaml (305, 2023-07-06)
prompts\deepset-multiple-choice-question-answering.md (899, 2023-07-06)
... ...
# PromptHub
PromptHub serves a collection of ready-made prompts for the most common NLP tasks. The service is deployed at the
public URL https://api.prompthub.deepset.ai and there's a nice UI to browse the prompts at https://prompthub.deepset.ai.
## Prompt format
A prompt is defined in a yaml file with the following format:
```yaml
name: an-example
text: Your prompt text goes here
description: A brief description of what your prompt is for
tags:
- translation
meta:
authors:
- your name
version: v0.1
```
## PromptHub API
### Get all the prompts
`GET /prompts`
Request:
```sh
curl -i -H 'Accept: application/json' http://api.prompthub.deepset.ai/prompts
```
Response:
```
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Fri, 24 Mar 2023 07:59:55 GMT
Content-Length: 42
[
{
"name":"deepset/an-example-prompt",
"tags":["question-answering"],
"meta":{"authors":["Alice","Bob"]},
"version":"1.0",
"prompt_text":"My prompt text",
"description":"Provides a prompt for question answering with references to documents"
}
]
```
### Get a specific prompt by name
`GET /prompts/prompt-name`
Request:
```sh
curl -i -H 'Accept: application/json' http://api.prompthub.deepset.ai/prompts/prompt-name
```
Response:
```
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Fri, 24 Mar 2023 08:06:19 GMT
Content-Length: 211
{"name":"prompt-name","tags":["translation"],"meta":{"authors":["vblagoje"]},"version":"v0.1.0","prompt_text":"Your prompt text goes here","description":"Prompt to translate text into a target language"}
```
### Get a model card by model name
Request:
```sh
curl -i http://api.prompthub.deepset.ai/cards/prompt-name
```
Response:
```
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Vary: Origin
Date: Wed, 07 Jun 2023 10:46:53 GMT
Content-Length: 762
This prompt is simply designed to answer a `query` given a set of `documents`. There will be 1 answer generated.
...
```
## API clients
You can consume the PromptHub API natively from one of the supported languages:
- Python: https://github.com/deepset-ai/prompthub-py
- Typescript: https://github.com/deepset-ai/prompthub-ts
## Run the PromptHub API by yourself
The easiest way to run the PromptHub API on your premises is to use the official Docker image:
```sh
$ docker run -p80:80 deepset/prompthub
INFO Prompthub running at 0.0.0.0:80
```
You can also serve your very own set of prompts by overriding the default `prompts` folder in the container:
```sh
$ docker run -p80:80 --volume $PWD/path/to/your/prompts:/prompts deepset/prompthub
INFO Prompthub running at 0.0.0.0:80
```
## Development
You can build and run the PromptHub API service locally following these steps:
- Ensure you have a recent version of [Go](https://go.dev) installed:
```sh
$ go version
go version go1.20.2 darwin/arm***
```
If you get an error, follow the install instructions from the [official documentation](https://go.dev/doc/install) and
try again.
- From the root of the repo, build the binary with:
```sh
$ go build
```
- Run the server with:
```sh
$ ./prompthub
```
- Run the tests with:
```sh
$ go test ./...
```
近期下载者:
相关文件:
收藏者: