This file contains hidden or 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
| import labelbox as lb | |
| import transformers | |
| import torch | |
| import torch.nn.functional as F | |
| from PIL import Image | |
| import requests | |
| import numpy as np | |
| # Add your API key | |
| API_KEY = "your_api_key_here" |
This file contains hidden or 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
| import labelbox as lb | |
| client = lb.Client(api_key="<YOUR_API_KEY>") | |
| dataset = client.create_dataset(name='<dataset_name>') | |
| dataset.create_data_rows("<data row payload>") |
This file contains hidden or 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
| from uuid import uuid4 | |
| def import_conversational (chain_results: dict[str:str], user_id_dict: dict[str:str], output_user_name: str) -> dict[str:str]: | |
| """Turn chain_result dictionary object from Langchain to conversation data for Labelbox | |
| Args: | |
| chain_results (dict[str:str]): LangChain evaluation results. | |
| user_id_dict (dict[str:str]): Dictionary matching chat type of LangChain(user) to Labelbox type with corresponding Labelbox UserID and Chat Alignment. | |
| {<Langchain user>: {id: <labelbox userid>, "alight", <Labelbox alignment (right or left)>}} | |
| output_user_name (str): LangChain output user type. |
This file contains hidden or 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
| chain_results = run_on_dataset( | |
| dataset_name=LS_DATASET_NAME, | |
| llm_or_chain_factory=functools.partial( | |
| create_agent, prompt=prompt, llm_with_tools=llm_with_tools | |
| ), | |
| evaluation=evaluation_config, | |
| verbose=True, | |
| client=client, | |
| project_name=f"tools-agent-test-5d466cbc-{unique_id}", | |
| # Project metadata communicates the experiment parameters, |