mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-16 22:03:05 +08:00
docs: salvage focused stale PR contributions
- add Vite and Redis pattern skills from closed stale PRs - add frontend-slides support assets - port skill-comply runner fixes and LLM prompt/provider regressions - harden agent frontmatter validation and sync catalog counts
This commit is contained in:
committed by
Affaan Mustafa
parent
d8f879e671
commit
b39d2244cf
@@ -57,27 +57,39 @@ class ClaudeProvider(LLMProvider):
|
||||
}
|
||||
if input.max_tokens:
|
||||
params["max_tokens"] = input.max_tokens
|
||||
else:
|
||||
params["max_tokens"] = 8192 # required by Anthropic API
|
||||
if input.tools:
|
||||
else:
|
||||
params["max_tokens"] = 8192 # required by Anthropic API
|
||||
if input.tools:
|
||||
params["tools"] = [tool.to_anthropic_tool() for tool in input.tools]
|
||||
|
||||
response = self.client.messages.create(**params)
|
||||
|
||||
tool_calls = None
|
||||
if response.content and hasattr(response.content[0], "type"):
|
||||
if response.content[0].type == "tool_use":
|
||||
tool_calls = [
|
||||
ToolCall(
|
||||
id=getattr(response.content[0], "id", ""),
|
||||
name=getattr(response.content[0], "name", ""),
|
||||
arguments=getattr(response.content[0].input, "__dict__", {}),
|
||||
)
|
||||
]
|
||||
|
||||
return LLMOutput(
|
||||
content=response.content[0].text if response.content else "",
|
||||
tool_calls=tool_calls,
|
||||
text_parts: list[str] = []
|
||||
tool_calls: list[ToolCall] = []
|
||||
for block in response.content or []:
|
||||
block_type = getattr(block, "type", None)
|
||||
if block_type == "text":
|
||||
text = getattr(block, "text", "")
|
||||
if text:
|
||||
text_parts.append(text)
|
||||
elif block_type == "tool_use":
|
||||
raw_arguments = getattr(block, "input", {})
|
||||
arguments = (
|
||||
raw_arguments.copy()
|
||||
if isinstance(raw_arguments, dict)
|
||||
else getattr(raw_arguments, "__dict__", {}).copy()
|
||||
)
|
||||
tool_calls.append(
|
||||
ToolCall(
|
||||
id=getattr(block, "id", ""),
|
||||
name=getattr(block, "name", ""),
|
||||
arguments=arguments,
|
||||
)
|
||||
)
|
||||
|
||||
return LLMOutput(
|
||||
content="".join(text_parts),
|
||||
tool_calls=tool_calls or None,
|
||||
model=response.model,
|
||||
usage={
|
||||
"input_tokens": response.usage.input_tokens,
|
||||
|
||||
Reference in New Issue
Block a user