Spaces:
Runtime error
Runtime error
File size: 2,837 Bytes
b3509ba |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"import os\n",
"from pathlib import Path\n",
"import json\n",
"from pathlib import Path\n",
"sys.path.append('..')\n",
"\n",
"from swarmai.utils.ai_engines import LanchainGoogleEngine"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"D:\\00Repos\\GPT-Swarm\\keys.json\n"
]
}
],
"source": [
"keys_file = Path(\".\").resolve().parent / \"keys.json\"\n",
"print(keys_file)\n",
"with open(keys_file) as f:\n",
" keys = json.load(f)\n",
"os.environ[\"OPENAI_API_KEY\"] = keys[\"OPENAI_API_KEY\"]\n",
"os.environ[\"CUSTOM_SEARCH_ENGINE_ID\"] = keys[\"CUSTOM_SEARCH_ENGINE_ID\"]\n",
"os.environ[\"GOOGLE_CSE_ID\"] = keys[\"CUSTOM_SEARCH_ENGINE_ID\"]\n",
"os.environ[\"GOOGLE_API_KEY\"] = keys[\"GOOGLE_API_KEY\"]"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"engine = LanchainGoogleEngine(\"gpt-3.5-turbo\", 0.5, 1000)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['https://www.crunchbase.com/organization/mips-technologies', 'https://www.crunchbase.com/organization/via', 'https://www.crunchbase.com/organization/otep-technologies-limited', 'https://www.crunchbase.com/organization/cambricon-technologies', 'https://www.crunchbase.com/organization/hailo-technologies', 'https://www.crunchbase.com/organization/transmeta', 'https://www.crunchbase.com/organization/concurrent-technologies-plc', 'https://www.crunchbase.com/organization/texas-instruments', 'https://www.crunchbase.com/organization/amd', 'https://www.crunchbase.com/organization/morphics-technology-inc']\n"
]
}
],
"source": [
"output = engine.search_sources(\"site:crunchbase.com/organization computer processors and related technologies\", n=10)\n",
"links = [item[\"link\"] for item in output]\n",
"print(links)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv_gptswarm",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
|