Class: ClaudeSwarm::OpenAI::ChatCompletion
- Inherits:
-
Object
- Object
- ClaudeSwarm::OpenAI::ChatCompletion
- Defined in:
- lib/claude_swarm/openai/chat_completion.rb
Constant Summary collapse
- MAX_TURNS_WITH_TOOLS =
virtually infinite
100_000
Instance Method Summary collapse
- #execute(prompt, options = {}) ⇒ Object
-
#initialize(openai_client:, mcp_client:, available_tools:, executor:, instance_name:, model:, temperature: nil, reasoning_effort: nil, zdr: false) ⇒ ChatCompletion
constructor
A new instance of ChatCompletion.
- #reset_session ⇒ Object
Constructor Details
#initialize(openai_client:, mcp_client:, available_tools:, executor:, instance_name:, model:, temperature: nil, reasoning_effort: nil, zdr: false) ⇒ ChatCompletion
Returns a new instance of ChatCompletion.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/claude_swarm/openai/chat_completion.rb', line 8 def initialize(openai_client:, mcp_client:, available_tools:, executor:, instance_name:, model:, temperature: nil, reasoning_effort: nil, zdr: false) @openai_client = openai_client @mcp_client = mcp_client @available_tools = available_tools @executor = executor @instance_name = instance_name @model = model @temperature = temperature @reasoning_effort = reasoning_effort @zdr = zdr # Not used in chat_completion API, but kept for compatibility @conversation_messages = [] end |
Instance Method Details
#execute(prompt, options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/claude_swarm/openai/chat_completion.rb', line 21 def execute(prompt, = {}) # Build messages array = (prompt, ) # Process chat with recursive tool handling result = process_chat_completion() # Update conversation state @conversation_messages = result end |
#reset_session ⇒ Object
34 35 36 |
# File 'lib/claude_swarm/openai/chat_completion.rb', line 34 def reset_session @conversation_messages = [] end |