66 lines
2.0 KiB
Python
66 lines
2.0 KiB
Python
import os
|
|
import sys
|
|
from typing import Optional
|
|
from pydantic import BaseModel
|
|
from openai import OpenAI
|
|
|
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '_data')))
|
|
from api_keys import OPENAI_API_KEY
|
|
|
|
client = OpenAI(api_key=OPENAI_API_KEY)
|
|
|
|
class PreliminaryAngebot(BaseModel):
|
|
name: str = ""
|
|
beschreibung: str = ""
|
|
strasse: Optional[str] = ""
|
|
hausNr: Optional[str] = ""
|
|
plz: str = ""
|
|
ort: str = ""
|
|
adresseZusatz: str = ""
|
|
|
|
web: str = ""
|
|
mail: Optional[str] = ""
|
|
telefon: Optional[str] = ""
|
|
fax: Optional[str] = ""
|
|
|
|
kategorie: Optional[str] = ""
|
|
unterkategorie: Optional[str] = ""
|
|
themen: Optional[str] = ""
|
|
|
|
traeger: Optional[str] = ""
|
|
zielgruppe: Optional[str] = ""
|
|
angebote: Optional[str] = ""
|
|
oeffnungsZeiten: Optional[str] = ""
|
|
kostenuebernahme: Optional[str] = ""
|
|
sprache: Optional[str] = ""
|
|
barrierefreiheit: Optional[str] = ""
|
|
konstellation: Optional[str] = ""
|
|
|
|
restInput: str = ""
|
|
changedInputFields: str = ""
|
|
|
|
|
|
inputText = '''
|
|
Hier sind Daten eines psychologischen Angebots. Bitte fehlende Daten ergänzen und fehlerhafte ggf. ersetzen.
|
|
Priorität hat die Angabe der korrekten Webseite zu dem Angebot, falls nicht schon vorhanden. Die Webseite muss spezifisch zu dem Angebot sein - sonst ignorieren. Ist schon eine angegeben, ersetze sie nur, wenn die alte Webseite ungültig ist.
|
|
|
|
Nutze das Feld 'restInput' für Infos zu dem Angebot, falls diese thematisch nicht in die restlichen Felder passen.
|
|
Hast du Felder inhaltlich verändert, liste ihre Namen in 'changedInputFields' auf.
|
|
|
|
Kinder- und Jugendpsychiatrische Praxis
|
|
Dr. med. Joachim Schreck
|
|
Theodor-Heuss-Ring 1, 50668 Köln
|
|
0221 / 733773
|
|
'''
|
|
|
|
response = client.responses.parse(
|
|
model="gpt-4o-mini",
|
|
tools=[{"type": "web_search_preview"}],
|
|
input=inputText,
|
|
text_format=PreliminaryAngebot,
|
|
)
|
|
print('### Input ###\n', inputText.replace('\r', '').replace('\n', ' '))
|
|
print('\n### Response ###\n', response.output_text)
|
|
|
|
print("\nOk ciao")
|