@@ -46,49 +46,6 @@ A module for accessing files provided to the bot.
4646
4747Reads the content of a file.
4848
49- ## ` gemini `
50-
51- This module provides a single function, generate_content, which uses the
52- Gemini API to generate text, optionally with an image as context.
53-
54- It accepts the following keyword arguments:
55-
56- - model (str): The name of the model to use for generation (e.g., "gemini-1.5-flash").
57- - contents (list of (str, str) tuples): A list of (role, text) tuples representing
58- the conversation history. Valid roles are typically "user" and "model".
59- - image (bytes, optional): The raw bytes of an image to include. The image is
60- inserted as a new part just before the last part of the 'contents'.
61- This is useful for multimodal prompts (e.g., asking a question about an image).
62- - system_instructions (str, optional): System instructions to guide Gemini's response.
63- - unsafe (bool, optional): If set to true, disables all safety settings for the
64- content generation, allowing potentially harmful content. Use with caution.
65-
66- For example, for a text-only prompt:
67-
68- responses = gemini.generate_content(
69- model="gemini-1.5-flash",
70- contents=[
71- ("user", "Once upon a time,"),
72- ("model", "there was a brave knight."),
73- ("user", "What happened next?")
74- ],
75- system_instructions="You are a creative story writer. Write a short story based on the provided prompt."
76- )
77-
78- To ask a question about an image:
79-
80- image_data = ... # read image file content as bytes
81- responses = gemini.generate_content(
82- model="gemini-1.5-flash",
83- contents=[
84- ("user", "Describe this image in detail.")
85- ],
86- image=image_data
87- )
88-
89- The responses variable will contain a list of generated responses, where each response
90- is a list of strings representing the parts of the generated content.
91-
9249## ` llm `
9350
9451LLM provider.
0 commit comments