Writer Palmyra X4 - Amazon Bedrock

Writer Palmyra X4

Writer Palmyra X4는 컨텍스트 기간이 최대 128,000개의 토큰인 모델입니다. 이 모델은 복잡한 태스크를 처리하고 이해하는 데 뛰어나므로 워크플로 자동화, 코딩 태스크 및 데이터 분석에 적합합니다.

  • 공급자 - Writer

  • 범주 - 텍스트 생성, 코드 생성, 풍부한 텍스트 형식 지정

  • 마지막 버전 - v1

  • 릴리스 날짜 - 2025년 4월 28일

  • 모델 ID - writer.palmyra-x4-v1:0

  • 형식 - 텍스트

  • 최대 토큰 - 입력: 토큰 122,880개, 출력: 토큰 8,192개

  • 언어 - 영어, 스페인어, 프랑스어, 독일어, 중국어 및 기타 여러 언어

  • 배포 유형 - 서버리스

Palmyra X4 간접 호출 요청 본문 필드

Writer 모델을 사용하여 InvokeModel 또는 InvokeModelWithResponseStream 직접 호출을 수행할 경우, 아래 항목을 준수하는 JSON 객체로 body 필드를 채웁니다. text_prompts 객체의 text 필드에 프롬프트를 입력합니다.

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

아래 표에는 숫자 파라미터의 최소값, 최대값, 기본값이 나와 있습니다.

파라미터 유형 Default 범위/검증 설명

messages

array

필수

1-∞ 항목

채팅 기록 메시지

temperature

float

1.0

0.0 ≤ x ≤ 2.0

샘플링 온도

top_p

float

1.0

0.0 < 값 ≤ 1.0

Nucleus 샘플링 임계값

max_tokens

int

16

1 ≤ x ≤ 8192

생성할 최대 토큰 수

min_tokens

int

0

0 ≤ x ≤ max_tokens

중지 전 최소 토큰

중단

array

[]

≤4 항목

중지 시퀀스

시드

int

null

모든 정수

Random seed(임의 시드)

presence_penalty

float

0.0

-2.0 ≤ x ≤ 2.0

새 토큰 존재 페널티

frequency_penalty

float

0.0

-2.0 ≤ x ≤ 2.0

토큰 빈도 페널티

Palmyra X4 간접 호출 응답 본문 필드

Writer Palmyra X4에 대한 응답 JSON은 다음 형식을 사용합니다.

{ "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 X4 예제 코드

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)