Update README.md
Browse files
README.md
CHANGED
@@ -57,6 +57,32 @@ Score: {'The Frog Prince': {'The movie "The Princess and the Frog" is loosely ba
|
|
57 |
'''
|
58 |
```
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
#### F1 Score
|
61 |
```python
|
62 |
from qa_metrics.f1 import f1_match,f1_score_with_precision_recall
|
|
|
57 |
'''
|
58 |
```
|
59 |
|
60 |
+
#### Prompting LLM For Evaluation
|
61 |
+
|
62 |
+
Note: The prompting function can be used for any prompting purposes.
|
63 |
+
|
64 |
+
###### OpenAI
|
65 |
+
```python
|
66 |
+
from qa_metrics.prompt_llm import *
|
67 |
+
set_openai_api_key(YOUR_OPENAI_KEY)
|
68 |
+
prompt = 'question: What is the Capital of France?\nreference: Paris\ncandidate: The capital is Paris\nIs the candidate answer correct based on the question and reference answer? Please only output correct or incorrect.'
|
69 |
+
prompt_gpt(prompt=prompt, model_engine='gpt-3.5-turbo', temperature=0.1, max_token=10)
|
70 |
+
|
71 |
+
'''
|
72 |
+
'correct'
|
73 |
+
'''
|
74 |
+
```
|
75 |
+
|
76 |
+
###### Anthropic
|
77 |
+
```python
|
78 |
+
set_anthropic_api_key(YOUR_OPENAI_KEY)
|
79 |
+
prompt_claude(prompt=prompt, model_engine='claude-v1', anthropic_version="2023-06-01", max_tokens_to_sample=100, temperature=0.7)
|
80 |
+
|
81 |
+
'''
|
82 |
+
'correct'
|
83 |
+
'''
|
84 |
+
```
|
85 |
+
|
86 |
#### F1 Score
|
87 |
```python
|
88 |
from qa_metrics.f1 import f1_match,f1_score_with_precision_recall
|