Skip to content

Commit

Permalink
pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Nweaver412 committed Jan 9, 2025
1 parent b6401c8 commit f8afd78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ env:
KBC_DEVELOPERPORTAL_VENDOR: kds-team
KBC_DEVELOPERPORTAL_APP: kds-team.embed-lancedb
KBC_DEVELOPERPORTAL_USERNAME: kds-team+nate_test
KBC_DEVELOPERPORTAL_PASSWORD: '${{ secrets.KBC_DEVELOPERPORTAL_PASSWORD }}'
DOCKERHUB_USER: nweaver412
DOCKERHUB_TOKEN: '${{ secrets.DOCKERHUB_TOKEN }}'
KBC_STORAGE_TOKEN: '${{ secrets.KBC_STORAGE_TOKEN }}'
KBC_DEVELOPERPORTAL_PASSWORD: ${{ secrets.KBC_DEVELOPERPORTAL_PASSWORD }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
KBC_STORAGE_TOKEN: ${{ secrets.KBC_STORAGE_TOKEN }}
KBC_TEST_PROJECT_URL: ''
KBC_TEST_PROJECT_CONFIGS: ''
jobs:
Expand Down Expand Up @@ -103,4 +103,4 @@ jobs:
app_id: '${{ env.KBC_DEVELOPERPORTAL_APP }}'
username: '${{ env.KBC_DEVELOPERPORTAL_USERNAME }}'
password: '${{ env.KBC_DEVELOPERPORTAL_PASSWORD }}'
tag: '${{ needs.build.outputs.app_image_tag }}'
tag: '${{ needs.build.outputs.app_image_tag }}'
7 changes: 5 additions & 2 deletions src/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,16 @@ def init_configuration(self):
self._configuration: Configuration = Configuration.load_from_dict(self.configuration.parameters)

def init_client(self):
logging.getLogger("openai").setLevel(logging.WARNING)
self.client = OpenAI(api_key=self._configuration.pswd_apiKey)

def get_embedding(self, text):
if not isinstance(text, str) or not text.strip():
raise ValueError("Input text must be a non-empty string.")
try:
response = self.client.embeddings.create(input=[text], model=self._configuration.model)
return response.data[0].embedding
except Exception as e:
return response
except OpenAI.BadRequestError as e:
raise UserException(f"Error getting embedding: {str(e)}")

def _get_input_table(self):
Expand Down

0 comments on commit f8afd78

Please sign in to comment.