Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
fix: fixed enum issue for frontend compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoubmrx committed Mar 24, 2024
1 parent 60105f5 commit 0640a2a
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions hyko_toolkit/apis/gemini/text_embedding/metadata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from enum import Enum

import httpx
from hyko_sdk.models import CoreModel, Method
from pydantic import Field
Expand All @@ -14,10 +12,6 @@
)


class Model(str, Enum):
embedding001 = "models/embedding-001"


@func.set_input
class Inputs(CoreModel):
text: str = Field(..., description="Text to embed.")
Expand All @@ -26,10 +20,6 @@ class Inputs(CoreModel):
@func.set_param
class Params(CoreModel):
user_access_token: str = Field(description="API key")
model: Model = Field(
default=Model.embedding001.value,
description="gemini model to use.",
)


@func.set_output
Expand All @@ -50,12 +40,12 @@ async def call(inputs: Inputs, params: Params):
async with httpx.AsyncClient() as client:
res = await client.request(
method=Method.post,
url=f"https://generativelanguage.googleapis.com/v1beta/{params.model}:embedContent?key={params.user_access_token}",
url=f"https://generativelanguage.googleapis.com/v1beta/models/embedding-001:embedContent?key={params.user_access_token}",
headers={
"Content-Type": "application/json",
},
json={
"model": params.model,
"model": "models/embedding-001",
"content": {"parts": [{"text": inputs.text}]},
},
timeout=60 * 10,
Expand Down

0 comments on commit 0640a2a

Please sign in to comment.