Skip to content

Commit

Permalink
Merge pull request #3 from christo-olivier/feature/readme-examples
Browse files Browse the repository at this point in the history
Added more text-bison examples
  • Loading branch information
christo-olivier authored Mar 23, 2024
2 parents 5e46850 + dc5acb0 commit 52741e2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Here is an example of using a custom prompt that includes the `response_model_js
import inspect

from modelsmith import Forge
from vertexai.generative_models import GenerativeModel
from vertexai.language_models import TextGenerationModel

# Create your custom prompt
my_prompt = inspect.cleandoc("""
Expand All @@ -171,12 +171,13 @@ my_prompt = inspect.cleandoc("""
Here is the OUTPUT SCHEMA:
{{ response_model_json }}
""")

# Create your forge instance, passing your prompt
forge = Forge(
model=GenerativeModel("gemini-1.0-pro"), response_model=list, prompt=my_prompt
model=TextGenerationModel.from_pretrained("text-bison"),
response_model=list,
prompt=my_prompt,
)

# Generate a your response
Expand All @@ -193,7 +194,7 @@ The same example above would also work if the `response_model_json` was left out
import inspect

from modelsmith import Forge
from vertexai.generative_models import GenerativeModel
from vertexai.language_models import TextGenerationModel

# Create your custom prompt
my_prompt = inspect.cleandoc("""
Expand All @@ -204,7 +205,9 @@ my_prompt = inspect.cleandoc("""

# Create your forge instance, passing your prompt
forge = Forge(
model=GenerativeModel("gemini-1.0-pro"), response_model=list, prompt=my_prompt
model=TextGenerationModel.from_pretrained("text-bison"),
response_model=list,
prompt=my_prompt,
)

# Generate a your response
Expand Down

0 comments on commit 52741e2

Please sign in to comment.