Spaces:
Runtime error
Runtime error
Download test_date.py from ruisp/MonPol: direct link, hf CLI and curl.
- Browser
- Download file 1.63 kB
-
https://huggingface.co/spaces/ruisp/MonPol/resolve/main/test_date.py
- Command line
-
hf download hf://spaces/ruisp/MonPol/test_date.py
-
curl -L -o test_date.py https://huggingface.co/spaces/ruisp/MonPol/resolve/main/test_date.py
1.63 kB
| import json | |
| import pytest | |
| from langchain import PromptTemplate, LLMChain | |
| from langchain.chat_models import ChatOpenAI | |
| from FOMCTexts.prompts import PROMPT_EXTRACT_DATE | |
| PROMPT_DATE = PromptTemplate.from_template(PROMPT_EXTRACT_DATE) | |
| date_extractor = LLMChain(prompt=PROMPT_DATE, llm=ChatOpenAI(temperature=0, model_name='gpt-3.5-turbo')) | |
| def test_date_extraction(statement, expected_dict_date): | |
| dict_date = json.loads(date_extractor.run(statement).replace('\n', '').replace(' ', '')) | |
| for k in dict_date: | |
| assert dict_date[k] == expected_dict_date[k] | |