Skip to content

Commit af19eaf

Browse files
committed
modify docs and example
1 parent c9f06dd commit af19eaf

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

docs/docs/ai/llm.mdx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,27 @@ cocoindex.LlmSpec(
9797
</TabItem>
9898
</Tabs>
9999

100-
You can find the full list of models supported by Gemini [here](https://ai.google.dev/gemini-api/docs/models).
100+
You can find the full list of models supported by Gemini [here](https://ai.google.dev/gemini-api/docs/models).
101+
102+
### Anthropic
103+
104+
To use the Anthropic LLM API, you need to set the environment variable `ANTHROPIC_API_KEY`.
105+
You can generate the API key from [Anthropic API](https://console.anthropic.com/settings/keys).
106+
107+
A spec for Anthropic looks like this:
108+
109+
<Tabs>
110+
<TabItem value="python" label="Python" default>
111+
112+
```python
113+
cocoindex.LlmSpec(
114+
api_type=cocoindex.LlmApiType.ANTHROPIC,
115+
model="claude-3-5-sonnet-latest",
116+
)
117+
```
118+
119+
</TabItem>
120+
</Tabs>
121+
122+
You can find the full list of models supported by Anthropic [here](https://docs.anthropic.com/en/docs/about-claude/models/all-models).
123+

examples/manuals_llm_extraction/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ def manual_extraction_flow(flow_builder: cocoindex.FlowBuilder, data_scope: coco
9898
# Replace by this spec below, to use Gemini API model
9999
# llm_spec=cocoindex.LlmSpec(
100100
# api_type=cocoindex.LlmApiType.GEMINI, model="gemini-2.0-flash"),
101+
102+
# Replace by this spec below, to use Anthropic API model
103+
# llm_spec=cocoindex.LlmSpec(
104+
# api_type=cocoindex.LlmApiType.ANTHROPIC, model="claude-3-5-sonnet-latest"),
101105
output_type=ModuleInfo,
102106
instruction="Please extract Python module information from the manual."))
103107
doc["module_summary"] = doc["module_info"].transform(summarize_module)

0 commit comments

Comments
 (0)