-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Vertex AI
LLM
s documentation (#222)
- Loading branch information
1 parent
3c5fb70
commit 9652cc7
Showing
10 changed files
with
103 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/snippets/technical-reference/llm/together_inference_generate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
docs/snippets/technical-reference/llm/vertexaiendpointllm_generate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from distilabel.llm import VertexAIEndpointLLM | ||
from distilabel.tasks import TextGenerationTask | ||
|
||
llm = VertexAIEndpointLLM( | ||
task=TextGenerationTask(), | ||
endpoint_id="3466410517680095232", | ||
project="experiments-404412", | ||
location="us-central1", | ||
generation_kwargs={ | ||
"temperature": 1.0, | ||
"max_tokens": 128, | ||
"top_p": 1.0, | ||
"top_k": 10, | ||
}, | ||
) | ||
|
||
results = llm.generate( | ||
inputs=[ | ||
{"input": "Write a short summary about the Gemini astrological sign"}, | ||
], | ||
) | ||
# >>> print(results[0][0]["parsed_output"]["generations"]) | ||
# Geminis are known for their curiosity, adaptability, and love of knowledge. They are | ||
# also known for their tendency to be indecisive, impulsive and prone to arguing. They | ||
# are ruled by the planet Mercury, which is associated with communication, quick thinking, | ||
# and change. |
22 changes: 22 additions & 0 deletions
22
docs/snippets/technical-reference/llm/vertexaillm_generate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from distilabel.llm import VertexAILLM | ||
from distilabel.tasks import TextGenerationTask | ||
|
||
llm = VertexAILLM( | ||
task=TextGenerationTask(), model="gemini-pro", max_new_tokens=512, temperature=0.3 | ||
) | ||
|
||
results = llm.generate( | ||
inputs=[ | ||
{"input": "Write a short summary about the Gemini astrological sign"}, | ||
], | ||
) | ||
# >>> print(results[0][0]["parsed_output"]["generations"]) | ||
# Gemini, the third astrological sign in the zodiac, is associated with the element of | ||
# air and is ruled by the planet Mercury. People born under the Gemini sign are often | ||
# characterized as being intelligent, curious, and communicative. They are known for their | ||
# quick wit, adaptability, and versatility. Geminis are often drawn to learning and enjoy | ||
# exploring new ideas and concepts. They are also known for their social nature and ability | ||
# to connect with others easily. However, Geminis can also be seen as indecisive, restless, | ||
# and superficial at times. They may struggle with commitment and may have difficulty focusing | ||
# on one thing for too long. Overall, Geminis are known for their intelligence, curiosity, | ||
# and social nature. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
docs/snippets/technical-reference/pipeline/pipeline_llmpool_processllm_4.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters