You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Prompt-Engineering-Guide/pages/prompts/text-summarization/explain-concept.de.mdx

76 lines
3.1 KiB
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Konzepte mit LLMs erklären
import { Tabs, Tab } from 'nextra/components';
import { Callout } from 'nextra/components';
## Hintergrund
Der folgende Prompt testet die Fähigkeiten eines LLM, Konzepte zu erklären oder zusammenzufassen.
## Prompt
```markdown
Antibiotika sind eine Art Medikament, das verwendet wird, um bakterielle Infektionen zu behandeln. Sie wirken, indem sie entweder die Bakterien abtöten oder deren Vermehrung verhindern, was dem Immunsystem des Körpers ermöglicht, die Infektion abzuwehren. Antibiotika werden normalerweise oral in Form von Pillen, Kapseln oder flüssigen Lösungen eingenommen oder manchmal intravenös verabreicht. Sie sind nicht wirksam gegen virale Infektionen, und ihr unangemessener Einsatz kann zu Antibiotikaresistenz führen.
Erkläre das oben Gesagte in einem Satz:
```
## Code / API
<Tabs items={['GPT-4 (OpenAI)', 'Mixtral MoE 8x7B Instruct (Fireworks)']}>
<Tab>
```python
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[
{
"role": "user",
"content": "Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the bodys immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.\n\nExplain the above in one sentence:"
}
],
temperature=1,
max_tokens=250,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
```
</Tab>
<Tab>
```python
import fireworks.client
fireworks.client.api_key = "<FIREWORKS_API_KEY>"
completion = fireworks.client.ChatCompletion.create(
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
"role": "user",
"content": "Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the bodys immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.\n\nExplain the above in one sentence:",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
stream=True,
n=1,
top_p=1,
top_k=40,
presence_penalty=0,
frequency_penalty=0,
prompt_truncate_len=1024,
context_length_exceeded_behavior="truncate",
temperature=0.9,
max_tokens=4000
)
```
</Tab>
</Tabs>
## Referenz
- [Prompt Engineering Guide](https://www.promptingguide.ai/introduction/examples#text-summarization) (16. März 2023)