manaviel85370
commited on
Commit
·
b5d96fe
1
Parent(s):
cdd3ab6
format code
Browse files
src/nlp/playground/llm.py
CHANGED
@@ -16,12 +16,10 @@ class QwenLlmHandler:
|
|
16 |
)
|
17 |
st.info("Using LLM Qwen/Qwen2.5-Coder-32B-Instruct via inference API")
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
def extract_data(self, text:str, entities:str):
|
22 |
messages = [{
|
23 |
"role": "user",
|
24 |
-
"content": """
|
25 |
Es sollen keine Markdown Elemente enthalten sein, nur das JSON Objekt als string.
|
26 |
Gebe Nur das JSON als Antwort zurück. JSON_Schema:
|
27 |
{""" +
|
@@ -32,4 +30,3 @@ class QwenLlmHandler:
|
|
32 |
|
33 |
response = self.client.chat_completion(messages, max_tokens=1000)
|
34 |
return json.loads(response.choices[0].message.content)
|
35 |
-
|
|
|
16 |
)
|
17 |
st.info("Using LLM Qwen/Qwen2.5-Coder-32B-Instruct via inference API")
|
18 |
|
19 |
+
def extract_data(self, text: str, entities: str):
|
|
|
|
|
20 |
messages = [{
|
21 |
"role": "user",
|
22 |
+
"content": """Du bist ein NER-Model. Gebe die Veranstaltungsinformationen aus dem text in JSON Format zurück.
|
23 |
Es sollen keine Markdown Elemente enthalten sein, nur das JSON Objekt als string.
|
24 |
Gebe Nur das JSON als Antwort zurück. JSON_Schema:
|
25 |
{""" +
|
|
|
30 |
|
31 |
response = self.client.chat_completion(messages, max_tokens=1000)
|
32 |
return json.loads(response.choices[0].message.content)
|
|