Skip to content

Commit

Permalink
update import paths
Browse files Browse the repository at this point in the history
  • Loading branch information
TuanaCelik committed Jan 26, 2024
1 parent 913156d commit 76046e2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ To get started, you will need to install Haystack and the `google-vertex-haystac
Just like any other [generator component in Haystack 2.0-Beta](https://docs.haystack.deepset.ai/v2.0/docs/generators), to run the `GeminiGenerator` on its own, we simply have to call the `run()` method. However, unlike our other components, the run method here expects `parts` as input. A `Part` in the Google Vertex AI API can be anything from a message, to images, or even function calls. Here are the docstrings from the source code for the most up-to-date reference we could find [here.](https://github.com/googleapis/python-aiplatform/blob/5f6ad8df5a08e78a121a72a21e21d95abb072e58/vertexai/generative_models/_generative_models.py#L1427-L1446) Let’s run this component with a simple query 👇

```python
from google_vertex_haystack.generators.gemini import VertexAIGeminiGenerator
from haystack_integrations.components.generators.google_vertex import VertexAIGeminiGenerator
gemini = VertexAIGeminiGenerator(model="gemini-pro-vision", project_id='YOUR-GCP-PROJECT-ID')
gemini.run(parts = ["What is the most interesting thing you know?"])
Expand Down Expand Up @@ -119,7 +119,7 @@ tool = Tool([get_current_weather_func])
We can use this tool with the `VertexAIGeminiChatGenerator` and ask it to tell us how the function should be called to answer the question “What is the temperature in celsius in Berlin?”:

```python
from google_vertex_haystack.generators.chat.gemini import VertexAIGeminiChatGenerator
from haystack_integrations.components.generators.google_vertex import VertexAIGeminiChatGenerator
from haystack.dataclasses import ChatMessage
gemini_chat = VertexAIGeminiChatGenerator(model="gemini-pro", project_id='YOUR-GCP-PROJECT-ID', tools=[tool])
Expand Down Expand Up @@ -148,7 +148,7 @@ Alongside the individual use of the new Gemini components above, you can of cour
> As we are working on the full release of Haystack 2.0, components that are currently available in the Beta release are mostly focused on text. So, truly multi-modal applications as full Haystack pipelines is not yet possible. We are creating components that can easily handle other medias like images, audio, and video and will be back with examples soon!

```python
from google_vertex_haystack.generators.gemini import VertexAIGeminiGenerator
from haystack_integrations.components.generators.google_vertex import VertexAIGeminiGenerator
from haystack.components.fetchers.link_content import LinkContentFetcher
from haystack.components.converters import HTMLToDocument
from haystack.components.preprocessors import DocumentSplitter
Expand Down

1 comment on commit 76046e2

@vercel
Copy link

@vercel vercel bot commented on 76046e2 Jan 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.