

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

# Writer Palmyra X4
<a name="model-parameters-palmyra-x4"></a>

Writer Palmyra X4 ist ein Modell mit einem Kontextfenster von bis zu 128 000 Token. Dieses Modell zeichnet sich durch die Verarbeitung und das Verständnis komplexer Aufgaben aus und eignet sich daher ideal für Workflow-Automatisierung, Codierungsaufgaben und Datenanalyse.
+ Anbieter – Writer
+ Kategorien – Textgenerierung, Codegenerierung, Rich-Text-Formatierung
+ Letzte Version – V1
+ Veröffentlichungsdatum – 28. April 2025
+ Model ID: – `writer.palmyra-x4-v1:0`
+ Modalität – Text
+ Max. Token – Eingabe: 122 880 Token, Ausgabe: 8 192 Token
+ Sprache – Englisch, Spanisch, Französisch, Deutsch, Chinesisch und mehrere andere Sprachen
+ Bereitstellungstyp – Serverless

## Textfeld für die Palmyra-X4-Aufrufanforderung
<a name="model-parameters-palmyra-x4-request-body"></a>

Wenn Sie mit einem Writer-Modell einen [InvokeModel](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModel.html)- oder [InvokeModelWithResponseStream](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModelWithResponseStream.html)-Aufruf ausführen, füllen Sie das `body`-Feld mit einem JSON-Objekt aus, das dem unten stehenden entspricht. Geben Sie die Eingabeaufforderung in das Feld `text` im Objekt `text_prompts` ein.

```
{
"modelId": "writer.palmyra-x4-v1:0",
"contentType": "application/json",
"accept": "application/json",
"body": "{\"messages\":[{\"role\":\"user\",\"content\":{\"text\":\"Explain quantum computing in simple terms\"}}]}"
}
```

Die folgende Tabelle zeigt die minimalen, maximalen und standardmäßigen Werte für die numerischen Parameter.


****  

| Parameter | Typ | Standard | Bereich/Validierung | Beschreibung | 
| --- | --- | --- | --- | --- | 
| messages | Array | Erforderlich | 1-∞ Elemente | Nachrichten im Chatverlauf | 
| temperature | float | 1,0 | 0,0 ≤ x ≤ 2,0 | Sampling-Temperatur | 
| top\_p | float | 1,0 | 0,0 < Wert ≤ 1,0 | Nukleus-Sampling-Schwellenwert | 
| max\_tokens | int | 16 | 1 ≤ x ≤ 8 192 | Höchstzahl der zu generierenden Token | 
| min\_tokens | int | 0 | 0 ≤ x ≤ max\_token | Mindestanzahl an Token vor dem Beenden | 
| stop | Array | [] | ≤4 Einträge | Sequenzen beenden | 
| Seed | int | Null | Beliebige Ganzzahl | Random Seed (Zufällige Seed) | 
| presence\_penalty | float | 0.0 | -2,0 ≤ x ≤ 2,0 | Neue Token-Präsenzstrafe | 
| frequency\_penalty | float | 0.0 | -2,0 ≤ x ≤ 2,0 | Token-Frequenzstrafe | 

## Textfeld für die Palmyra-X4-Aufrufantwort
<a name="model-parameters-palmyra-x4-response-body"></a>

Die JSON-Antwort für Writer Palmyra X4 verwendet das folgende Format:

```
{
  "id": "chatcmpl-a689a6e150b048ca8814890d3d904d41",
  "object": "chat.completion",
  "created": 1745854231,
  "model": "writer.palmyra-x4-v1:0",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "reasoning_content": null,
        "content": "Quantum computing harnesses quantum mechanics to process information in extraordinarily powerful ways. Unlike classical bits, which are 0 or 1, quantum bits (qubits) can exist in multiple states simultaneously through superposition. Qubits also entangle, allowing them to be interconnected in such a way that the state of one (whether it's 0 or 1) can depend on the state of another, no matter the distance between them. This combination of superposition and entanglement enables quantum computers to solve complex problems much faster than classical computers, particularly in areas like cryptography, optimization, and simulations of molecular structures. However, quantum computing is still in its early stages, facing challenges in stability and scalability.",
        "tool_calls": []
      },
      "logprobs": null,
      "finish_reason": "stop",
      "stop_reason": null
    }
  ],
  "usage": {
    "prompt_tokens": 43,
    "total_tokens": 186,
    "completion_tokens": 143,
    "prompt_tokens_details": null
  },
  "prompt_logprobs": null
}
```

## Writer Palmyra X4Beispiel-Code für
<a name="model-parameters-palmyra-x4-example-code"></a>

Beispielcode für Writer Palmyra X4:

```
import boto3
import json
from botocore.exceptions import ClientError

client = boto3.client("bedrock-runtime", region_name="us-west-2")
model_id = "writer.palmyra-x4-v1:0"

# Format the request payload using the model's native structure.
native_request = {
    "temperature": 1,
    "messages": [
        {
            "role": "user",
            "content": "Explain quantum computing in simple terms.",
        }
    ],
}

# Convert the native request to JSON.
request = json.dumps(native_request)

try:
    # Invoke the model with the request.
    response = client.invoke_model(modelId=model_id, body=request)
except (ClientError, Exception) as e:
    print(f"ERROR: Can't invoke '{model_id}'. Reason: {e}")
    exit(1)

# Decode the response body.
model_response = json.loads(response["body"].read())

# Extract and print the response text.
response_text = model_response["content"][0]["text"]
print(response_text)
```