lynn-twinkl
commited on
Commit
·
e4fedf2
1
Parent(s):
34a810f
Changed to 4.1 nano; increased temp from 2 to 3, added a nother few-shot exammple
Browse files- functions/extract_usage.py +13 -5
functions/extract_usage.py
CHANGED
|
@@ -4,11 +4,11 @@ from typing import List, Dict, Any
|
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
load_dotenv()
|
| 6 |
|
| 7 |
-
def extract_usage(docs, max_concurrency: int =
|
| 8 |
|
| 9 |
llm = ChatOpenAI(
|
| 10 |
-
model='gpt-
|
| 11 |
-
temperature=0.
|
| 12 |
)
|
| 13 |
|
| 14 |
prompt = ChatPromptTemplate.from_messages(
|
|
@@ -24,9 +24,9 @@ def extract_usage(docs, max_concurrency: int = 10) -> List[List[str]]:
|
|
| 24 |
- Output the extracted items as a **clean, comma-separated list**, with no additional explanation or formatting.
|
| 25 |
- Do not include abstract goals or general program names (e.g., "Arts Award program" or "student development").
|
| 26 |
- Focus on concrete nouns that represent resources or services the grant would directly fund (e.g., "paint", "laptops", "counseling sessions", "sports equipment").
|
| 27 |
-
- If no tangible items or clearly defined services are found according to the spcifications above, simply return None.
|
| 28 |
|
| 29 |
-
## Example:
|
| 30 |
|
| 31 |
**User Input:**
|
| 32 |
_I work in an alternative provision supporting disadvantaged children with SEND. Many of our students face significant challenges in communication and emotional expression.
|
|
@@ -37,6 +37,14 @@ def extract_usage(docs, max_concurrency: int = 10) -> List[List[str]]:
|
|
| 37 |
|
| 38 |
**Your Output:**
|
| 39 |
paints, canvases, clay, sketchbooks, art therapist
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
"""
|
| 41 |
),
|
| 42 |
("human", "{input}")
|
|
|
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
load_dotenv()
|
| 6 |
|
| 7 |
+
def extract_usage(docs, max_concurrency: int = 15) -> List[List[str]]:
|
| 8 |
|
| 9 |
llm = ChatOpenAI(
|
| 10 |
+
model='gpt-4.1-nano',
|
| 11 |
+
temperature=0.3
|
| 12 |
)
|
| 13 |
|
| 14 |
prompt = ChatPromptTemplate.from_messages(
|
|
|
|
| 24 |
- Output the extracted items as a **clean, comma-separated list**, with no additional explanation or formatting.
|
| 25 |
- Do not include abstract goals or general program names (e.g., "Arts Award program" or "student development").
|
| 26 |
- Focus on concrete nouns that represent resources or services the grant would directly fund (e.g., "paint", "laptops", "counseling sessions", "sports equipment").
|
| 27 |
+
- If no **specific** tangible items or clearly defined services are found according to the spcifications above, simply return None.
|
| 28 |
|
| 29 |
+
## Example 1:
|
| 30 |
|
| 31 |
**User Input:**
|
| 32 |
_I work in an alternative provision supporting disadvantaged children with SEND. Many of our students face significant challenges in communication and emotional expression.
|
|
|
|
| 37 |
|
| 38 |
**Your Output:**
|
| 39 |
paints, canvases, clay, sketchbooks, art therapist
|
| 40 |
+
|
| 41 |
+
## Example 2:
|
| 42 |
+
|
| 43 |
+
**User Input:**
|
| 44 |
+
_I would use this to buy resources to support the outdoor teaching of science and get the students engaged. I work in a school with special educational needs pupils and this would go a long way in getting them enthisaisstic about science, a topic students often find boring and not very engaging._
|
| 45 |
+
|
| 46 |
+
**Your Output:**
|
| 47 |
+
None
|
| 48 |
"""
|
| 49 |
),
|
| 50 |
("human", "{input}")
|