Как написать подсказку, чтобы очистить компоненты (HTML, CSS, изображение, ссылка, заголовок, заголовок, тело и т. Д.) НJavascript

Форум по Javascript
Anonymous
Как написать подсказку, чтобы очистить компоненты (HTML, CSS, изображение, ссылка, заголовок, заголовок, тело и т. Д.) Н

Сообщение Anonymous »

Я могу создать экземпляр экземпляра Openai и получить объект Chatcompletions, но моя подсказка недостаточно хороша, чтобы показать все состав веб -страницы (сохранено как html -файл в моем диске). < /p>
Мое подсказку: < /p>

). < /p>
prompt = “”"

You have a content page from a website.

Get the individual components on this page like header, footer, image, title, body, metadata, links or any other content.

For each component, return:

- a title or heading

- a text content from that component if any

- any other metadata if present

- any images if available

Output the result in form of a JSON array with each element representing a component with its extracted fields.

Here is the HTML content:

\“\”\“{html}\”\“\”

Return only the JSON array.

“”"
< /code>
Как это улучшить?def get_components(html):

messages = \[
{“role”: “system”, “content”: prompt},

\]

client = OpenAI(api_key=OPENAI_API_KEY)

completion = client.chat.completions.create(

model="gpt-3.5-turbo",

messages=messages,

response_format= { "type":"json_object" },

temperature=0.7

)

print('\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*Response is \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*')

print(completion)


Подробнее здесь: https://stackoverflow.com/questions/797 ... ink-header

Вернуться в «Javascript»