Guitar
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
_PromptJsonGenerator Struct Reference

AIプロバイダーごとのリクエストJSONを生成するビジタークラス。 More...

Inheritance diagram for _PromptJsonGenerator:
Inheritance graph
[legend]
Collaboration diagram for _PromptJsonGenerator:
Collaboration graph
[legend]

Public Member Functions

 _PromptJsonGenerator (GenerativeAI::Model const &model, std::string const &prompt)
 
std::string modelname () const
 
std::string case_Unknown ()
 未知プロバイダー:空文字列を返す More...
 
std::string case_OpenAI_responses ()
 OpenAI Responses API 向けのリクエストJSONを生成する。 More...
 
std::string case_OpenAI_chat_completions ()
 OpenAI Chat Completions API 向けのリクエストJSONを生成する。 More...
 
std::string case_Anthropic ()
 Anthropic Claude 向けのリクエストJSONを生成する。 More...
 
std::string case_Google ()
 Google Gemini 向けのリクエストJSONを生成する。 More...
 
std::string case_XAI ()
 xAI:OpenAI Chat Completions 互換形式 More...
 
std::string case_PFN ()
 PFN:OpenAI Chat Completions 互換形式 More...
 
std::string case_Kimi ()
 Kimi. More...
 
std::string case_Sakura ()
 Sakura:OpenAI Chat Completions 互換形式 More...
 
std::string case_DeepSeek ()
 DeepSeek 向けのリクエストJSONを生成する。 More...
 
std::string case_Ollama ()
 Ollama 向けのリクエストJSONを生成する。 More...
 
std::string case_OpenRouter ()
 OpenRouter:OpenAI Chat Completions 互換形式 More...
 
std::string case_LMStudio ()
 LM Studio:Ollama 互換形式 More...
 
std::string case_LLAMACPP ()
 llama.cpp:OpenAI Chat Completions 互換形式 More...
 
- Public Member Functions inherited from GenerativeAI::AbstractVisitor< std::string >
virtual ~AbstractVisitor ()=default
 
virtual std::string case_OpenAI ()
 
std::string visit (ProviderID provider)
 

Public Attributes

std::string system_role
 
GenerativeAI::Model const & model
 
std::string prompt
 
bool add_stream_false = false
 

Static Public Attributes

constexpr static float temperature_ = 0.2f
 応答のランダム性(Anthropic以外で使用) More...
 

Detailed Description

AIプロバイダーごとのリクエストJSONを生成するビジタークラス。

プロバイダー名とプロンプトを受け取り、各APIが要求するJSON形式に組み立てる。

Constructor & Destructor Documentation

◆ _PromptJsonGenerator()

_PromptJsonGenerator::_PromptJsonGenerator ( GenerativeAI::Model const &  model,
std::string const &  prompt 
)
inline

Member Function Documentation

◆ case_Anthropic()

std::string _PromptJsonGenerator::case_Anthropic ( )
inlinevirtual

Anthropic Claude 向けのリクエストJSONを生成する。

Claude Opus 4.7(2026-04-16リリース)以降、temperature / top_p / top_k は 非推奨となりデフォルト以外の値を送ると HTTP 400 が返るため省略する。

Returns
リクエストJSON文字列

Implements GenerativeAI::AbstractVisitor< std::string >.

Here is the call graph for this function:

◆ case_DeepSeek()

std::string _PromptJsonGenerator::case_DeepSeek ( )
inlinevirtual

DeepSeek 向けのリクエストJSONを生成する。

streamingを無効化している点がOpenAI互換形式と異なる。

Returns
リクエストJSON文字列

Implements GenerativeAI::AbstractVisitor< std::string >.

◆ case_Google()

std::string _PromptJsonGenerator::case_Google ( )
inlinevirtual

Google Gemini 向けのリクエストJSONを生成する。

Gemini API はモデル名をURLパラメータで指定するため、JSONに含まない。

Returns
リクエストJSON文字列

Implements GenerativeAI::AbstractVisitor< std::string >.

Here is the call graph for this function:

◆ case_Kimi()

std::string _PromptJsonGenerator::case_Kimi ( )
inlinevirtual

◆ case_LLAMACPP()

std::string _PromptJsonGenerator::case_LLAMACPP ( )
inlinevirtual

llama.cpp:OpenAI Chat Completions 互換形式

Implements GenerativeAI::AbstractVisitor< std::string >.

◆ case_LMStudio()

std::string _PromptJsonGenerator::case_LMStudio ( )
inlinevirtual

LM Studio:Ollama 互換形式

Implements GenerativeAI::AbstractVisitor< std::string >.

◆ case_Ollama()

std::string _PromptJsonGenerator::case_Ollama ( )
inlinevirtual

Ollama 向けのリクエストJSONを生成する。

Ollama は独自フォーマットで prompt キーにプロンプトを渡す。

Returns
リクエストJSON文字列

Implements GenerativeAI::AbstractVisitor< std::string >.

Here is the call graph for this function:

◆ case_OpenAI_chat_completions()

std::string _PromptJsonGenerator::case_OpenAI_chat_completions ( )
inlinevirtual

OpenAI Chat Completions API 向けのリクエストJSONを生成する。

Returns
リクエストJSON文字列

Implements GenerativeAI::AbstractVisitor< std::string >.

Here is the call graph for this function:

◆ case_OpenAI_responses()

std::string _PromptJsonGenerator::case_OpenAI_responses ( )
inlinevirtual

OpenAI Responses API 向けのリクエストJSONを生成する。

Returns
リクエストJSON文字列

Implements GenerativeAI::AbstractVisitor< std::string >.

Here is the call graph for this function:

◆ case_OpenRouter()

std::string _PromptJsonGenerator::case_OpenRouter ( )
inlinevirtual

OpenRouter:OpenAI Chat Completions 互換形式

Implements GenerativeAI::AbstractVisitor< std::string >.

◆ case_PFN()

std::string _PromptJsonGenerator::case_PFN ( )
inlinevirtual

PFN:OpenAI Chat Completions 互換形式

Implements GenerativeAI::AbstractVisitor< std::string >.

◆ case_Sakura()

std::string _PromptJsonGenerator::case_Sakura ( )
inlinevirtual

Sakura:OpenAI Chat Completions 互換形式

Implements GenerativeAI::AbstractVisitor< std::string >.

◆ case_Unknown()

std::string _PromptJsonGenerator::case_Unknown ( )
inlinevirtual

未知プロバイダー:空文字列を返す

Implements GenerativeAI::AbstractVisitor< std::string >.

◆ case_XAI()

std::string _PromptJsonGenerator::case_XAI ( )
inlinevirtual

xAI:OpenAI Chat Completions 互換形式

Implements GenerativeAI::AbstractVisitor< std::string >.

◆ modelname()

std::string _PromptJsonGenerator::modelname ( ) const
inline
Here is the call graph for this function:

Member Data Documentation

◆ add_stream_false

bool _PromptJsonGenerator::add_stream_false = false

◆ model

GenerativeAI::Model const& _PromptJsonGenerator::model

◆ prompt

std::string _PromptJsonGenerator::prompt

◆ system_role

std::string _PromptJsonGenerator::system_role

◆ temperature_

constexpr static float _PromptJsonGenerator::temperature_ = 0.2f
staticconstexpr

応答のランダム性(Anthropic以外で使用)


The documentation for this struct was generated from the following file: