objects76 commited on
Commit
bb77034
1 Parent(s): b08befe

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +48 -0
README.md CHANGED
@@ -127,3 +127,51 @@ print('response=', response)
127
  print('label=', label)
128
  ```
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  print('label=', label)
128
  ```
129
 
130
+
131
+ ### few-shot
132
+ ```python
133
+
134
+ system = ('Your task is to extract specific information from the given text.'
135
+ ' Please provide the requested information in the format shown in the examples below.'
136
+ )
137
+
138
+ fewshot_example = '''\
139
+ Example 1:
140
+ Text: John Smith is a 35-year-old software engineer from New York. He has been working at TechCorp for 5 years.
141
+ Name: John Smith
142
+ Age: 35
143
+ Occupation: Software Engineer
144
+ Location: New York
145
+ Company: TechCorp
146
+ Years of Experience: 5
147
+
148
+ Example 2:
149
+ Text: Sarah Johnson, a 28-year-old marketing specialist, recently moved to San Francisco to join StartupX as their new Head of Marketing.
150
+ Name: Sarah Johnson
151
+ Age: 28
152
+ Occupation: Marketing Specialist
153
+ Location: San Francisco
154
+ Company: StartupX
155
+ Position: Head of Marketing
156
+
157
+ Now, extract the information from the following text:
158
+ Text: Michael Brown, 42, is a senior data scientist at DataInc in Chicago. He has been in the field for over a decade and specializes in machine learning algorithms.
159
+ '''
160
+
161
+ answer_from_gpt = '''\
162
+ Name: Michael Brown
163
+ Age: 42
164
+ Occupation: Senior Data Scientist
165
+ Location: Chicago
166
+ Company: DataInc
167
+ Years of Experience: Over a decade
168
+ Specialization: Machine Learning Algorithms
169
+ '''
170
+
171
+ messages = [
172
+ {"role": "system", "content": system.strip()},
173
+ {"role": "user", "content": fewshot_example.strip()},
174
+ ]
175
+ ```
176
+
177
+