@@ -72,16 +72,23 @@ def image_object_embedding_flow(
7272 caption_ds = img ["content" ].transform (
7373 cocoindex .functions .ExtractByLlm (
7474 llm_spec = cocoindex .llm .LlmSpec (
75- api_type = cocoindex .LlmApiType .GEMINI ,
76- model = "gemini-1.5-flash " ,
75+ api_type = cocoindex .LlmApiType .OLLAMA ,
76+ model = "llama3.1 " ,
7777 ),
78+ # Replace by this spec below, to use OpenAI API model instead of ollama
79+ # llm_spec=cocoindex.LlmSpec(
80+ # api_type=cocoindex.LlmApiType.OPENAI, model="gpt-4o"),
81+ # Replace by this spec below, to use Gemini API model
82+ # llm_spec=cocoindex.LlmSpec(
83+ # api_type=cocoindex.LlmApiType.GEMINI, model="gemini-2.0-flash"),
84+ # Replace by this spec below, to use Anthropic API model
85+ # llm_spec=cocoindex.LlmSpec(
86+ # api_type=cocoindex.LlmApiType.ANTHROPIC, model="claude-3-5-sonnet-latest"),
7887 instruction = (
79- "Describe this image in one detailed, natural language sentence. "
80- "Always explicitly name every visible animal species, object, and the main scene. "
81- "Be specific about the type, color, and any distinguishing features. "
82- "Avoid generic words like 'animal' or 'creature'—always use the most precise name (e.g., 'elephant', 'cat', 'lion', 'zebra'). "
83- "If an animal is present, mention its species and what it is doing. "
84- "For example: 'A large grey elephant standing in a grassy savanna, with trees in the background.'"
88+ "Describe the image in one detailed sentence. "
89+ "Name all visible animal species, objects, and the main scene. "
90+ "Be specific about type, color, and notable features. "
91+ "Mention what each animal is doing."
8592 ),
8693 output_type = str ,
8794 )
0 commit comments