Writer Palmyra X4
Writer Palmyra X4 è un modello con una finestra contestuale di un massimo di 128.000 token. Questo modello eccelle nell’elaborazione e nella comprensione di attività complesse, caratteristiche che lo rendono ideale per l’automazione del flusso di lavoro, le attività di codifica e l’analisi dei dati.
Provider: Writer
Categorie: generazione di testo, generazione di codice, formattazione RTF
Ultima versione: v1
Data di rilascio: 28 aprile 2025
ID modello:
writer.palmyra-x4-v1:0Modalità: testo
Numero massimo di token – input: 122.880 token, output: 8.192 token
Lingua: inglese, spagnolo, francese, tedesco, cinese e molte altre lingue
Tipo di implementazione: serverless
Campo del corpo della richiesta per l’invocazione di Palmyra X4
Quando esegui una chiamata InvokeModel o InvokeModelWithResponseStream utilizzando un modello Writer, inserisci nel campo body un oggetto JSON conforme a quello seguente. Immetti il prompt nel campo text dell’oggetto text_prompts.
{ "modelId": "writer.palmyra-x4-v1:0", "contentType": "application/json", "accept": "application/json", "body": "{\"messages\":[{\"role\":\"user\",\"content\":{\"text\":\"Explain quantum computing in simple terms\"}}]}" }
La tabella che segue mostra i valori minimo, massimo e predefinito per i parametri numerici.
| Parametro | Tipo | Valore predefinito | Intervallo/convalida | Descrizione |
|---|---|---|---|---|
messages |
array |
Obbligatorio |
1-∞ elementi |
Messaggi di cronologia chat |
temperature |
float |
1,0 |
0,0 ≤ x ≤ 2,0 |
Temperatura campionamento |
top_p |
float |
1,0 |
0,0 < valore ≤ 1,0 |
Soglia campionamento nucleus |
max_tokens |
int |
16 |
1 ≤ x ≤ 8.192 |
Numero massimo di token da generare |
min_tokens |
int |
0 |
0 ≤ x ≤ max_tokens |
Numero minimo di token prima dell’arresto |
stop |
array |
[] |
≤4 inserimenti |
Sequenze di arresto |
seed |
int |
nullo |
Qualsiasi numero intero |
Seed casuale |
presence_penalty |
float |
0,0 |
-2,0 ≤ x ≤ 2,0 |
Nuova penalità per presenza di token |
frequency_penalty |
float |
0,0 |
-2,0 ≤ x ≤ 2,0 |
Penalità per frequenza di token |
Campo del corpo della risposta per l’invocazione di Palmyra X4
La risposta JSON per Writer Palmyra X4 utilizza il seguente formato:
{ "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 }
Codice di esempio per Writer Palmyra X4
Esempio di codice per 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)