Anthropic Claude AI

Anthropic Claude AI 모델을 Delphi 애플리케이션에 통합해 보세요. Claude 3.5 Sonnet, Haiku, Opus로 채팅 완성을 사용할 수 있어요.

TsgcHTTP_API_Anthropic

Claude Messages, Files, Batches, 토큰 카운팅을 위한 Anthropic REST API 클라이언트예요.

컴포넌트 클래스

TsgcHTTP_API_Anthropic

프로토콜

HTTPS 기반 Anthropic REST API

플랫폼

Windows, macOS, Linux, iOS, Android

에디션

Enterprise (AI 애드온)

컴포넌트를 놓고 속성 몇 가지만 설정하면 끝

AnthropicOptions에 API 키를 설정한 다음, _CreateMessage 같은 타입 헬퍼 메서드를 호출하거나 TsgcAnthropicClass_Request_Messages를 빌드하여 CreateMessage를 호출해 보세요.

uses
  sgcHTTP_API_Anthropic;

var
  Anthropic: TsgcHTTP_API_Anthropic;
begin
  Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
  Anthropic.AnthropicOptions.ApiKey := 'sk-ant-...';
  Anthropic.AnthropicOptions.AnthropicVersion := '2023-06-01';

  // Simple one-shot message
  Memo1.Lines.Text := Anthropic._CreateMessage(
    'claude-3-5-sonnet-latest',
    'What are the benefits of WebSockets?',
    4096);

  // Streaming — handle OnHTTPAPISSE per delta
  Anthropic.OnHTTPAPISSE := HandleSSE;
  Anthropic._CreateMessageStream(
    'claude-3-5-sonnet-latest',
    'Summarise RFC 6455',
    1024);
end;

procedure TForm1.HandleSSE(Sender: TObject;
  const aEvent, aData: string;
  var Cancel: Boolean);
begin
  Memo1.Lines.Add(aEvent + ': ' + aData);
end;
// uses: sgcHTTP_API_Anthropic
TsgcHTTP_API_Anthropic *Anthropic = new TsgcHTTP_API_Anthropic(this);
Anthropic->AnthropicOptions->ApiKey = "sk-ant-...";
Anthropic->AnthropicOptions->AnthropicVersion = "2023-06-01";

// Simple one-shot message
Memo1->Lines->Text = Anthropic->_CreateMessage(
  "claude-3-5-sonnet-latest",
  "What are the benefits of WebSockets?",
  4096);

// Streaming — OnHTTPAPISSE fires per delta
Anthropic->OnHTTPAPISSE = HandleSSE;
Anthropic->_CreateMessageStream(
  "claude-3-5-sonnet-latest",
  "Summarise RFC 6455",
  1024);
using esegece.sgcWebSockets;

var anthropic = new TsgcHTTPAPI_Anthropic();
anthropic.AnthropicOptions.ApiKey = "sk-ant-...";
anthropic.AnthropicOptions.AnthropicVersion = "2023-06-01";

// Simple one-shot message
Console.WriteLine(anthropic._CreateMessage(
  "claude-3-5-sonnet-latest",
  "What are the benefits of WebSockets?",
  4096));

// Streaming via Server-Sent Events
anthropic.OnHTTPAPISSE += (sender, ev, data, cancel) => Console.Write(data);
anthropic._CreateMessageStream(
  "claude-3-5-sonnet-latest",
  "Summarise RFC 6455",
  1024);

내부 구성

5개의 속성, 7개의 공개 메서드, 2개의 이벤트. Messages, Files, Batches를 위한 타입 요청/응답 클래스를 제공해요.

Messages

CreateMessage는 타입이 지정된 TsgcAnthropicClass_Request_Messages를 전송하고 파싱된 응답을 반환해요. _CreateMessage, _CreateMessageWithSystem, _CreateMessageStream, _CreateMessageWithThinking은 JSON 문자열 단축 메서드예요.

비전, 문서 및 웹 검색

헬퍼 메서드인 _CreateVisionMessage(이미지 base64), _CreateDocumentMessage(PDF base64), _CreateMessageWithWebSearch는 멀티모달과 Claude 서버 측 도구를 래핑해요.

도구 사용 및 구조화 출력

TsgcAnthropicClass_Request_Tool 항목을 빌드하여 Claude에 함수 호출 도구를 노출시킬 수 있어요. _CreateMessageJSON은 구조화된 출력에 인라인 JSON 스키마를 적용해요.

Files API

UploadFile, ListFiles, DeleteFile 및 헬퍼 _GetFile, _DownloadFile은 Anthropic Files 엔드포인트를 통해 첨부 파일을 관리해요.

Batches API

ListBatches, CancelBatch 및 헬퍼 _GetBatch, _GetBatchResults는 대용량 오프라인 처리를 위한 Message Batches 워크플로우를 구동해요.

안정성 및 진단

CircuitBreaker는 API가 정상이 아닐 때 요청을 단락시켜요. ReadTimeoutTLSOptions는 HTTPS 계층을 조정해요. OnHTTPAPIException은 실패를 노출시키고, OnHTTPAPISSE는 서버 전송 이벤트를 스트리밍해요.

사양 및 참조 문서

이 컴포넌트가 구현하는 프로토콜의 공식 출처입니다.

문서 및 데모

컴포넌트 참조 문서로 바로 이동하고, 바로 실행 가능한 데모 프로젝트를 받고, 체험판을 다운로드해 보세요.

온라인 도움말 — Anthropic 이 컴포넌트의 전체 속성, 메서드, 이벤트 참조 문서.
데모 프로젝트 — Demos\AI\Anthropic 바로 실행 가능한 예제 프로젝트예요. sgcWebSockets 패키지에 포함되어 있어요 — 아래에서 체험판을 다운로드하세요.
기술 문서 (PDF) 기능, 빠른 시작, Delphi/C++ Builder/.NET 코드 샘플 및 1차 출처 참고 — 이 컴포넌트 전용.
사용자 설명서 (PDF) 라이브러리의 모든 컴포넌트를 다루는 종합 설명서.

Anthropic Claude를 통합할 준비가 되었나요?

무료 체험판을 다운로드하고 몇 분 안에 개발을 시작해 보세요.