Skip to content

Commit

Permalink
Merge pull request #239 from kreneskyp/metaphor_agent
Browse files Browse the repository at this point in the history
Agent: Metaphor search, implemented with OpenAI functions.
  • Loading branch information
kreneskyp authored Sep 18, 2023
2 parents a37c050 + f43d9f1 commit 323bc11
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ agents: cluster components
$(LOAD_FIXTURE) agent/wikipedia
$(LOAD_FIXTURE) agent/klarna
$(LOAD_FIXTURE) agent/smithy
$(LOAD_FIXTURE) agent/metaphor


# Generate fixture for NodeTypes defined in python fixtures.
Expand Down
180 changes: 180 additions & 0 deletions ix/chains/fixtures/agent/metaphor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
[
{
"model": "agents.agent",
"pk": "355a1aff-7c21-47b2-913d-a0550d091414",
"fields": {
"name": "Metaphor",
"alias": "metaphor",
"purpose": "Search the web using Metaphor search engine. Can perform a basic search and find similar results.\n\nAgent works best to direct commands:\n- \"search for <topic>\"\n- \"find sites similar to <topic>\"\n\n\nRequires that METAPHOR_API_KEY is set in environment config.",
"created_at": "2023-09-17T02:28:04.009Z",
"model": "",
"config": {},
"chain": "349ce049-9880-4811-9cf5-9f644cddded2",
"is_test": false
}
},
{
"model": "chains.chain",
"pk": "349ce049-9880-4811-9cf5-9f644cddded2",
"fields": {
"name": "Metaphor",
"description": "Search the web using Metaphor search engine. Can perform a basic search and find similar results.\n\nAgent works best to direct commands:\n- \"search for <topic>\"\n- \"find sites similar to <topic>\"\n\n\nRequires that METAPHOR_API_KEY is set in environment config.",
"created_at": "2023-09-17T02:28:03.992Z",
"is_agent": true
}
},
{
"model": "chains.chainnode",
"pk": "2b96ae9e-bdd2-4410-8513-e849473c777d",
"fields": {
"class_path": "langchain.chat_models.openai.ChatOpenAI",
"node_type": "bbb7544c-6891-4204-985a-d13d65e02523",
"config": {
"verbose": false,
"streaming": true,
"max_tokens": 256,
"model_name": "gpt-4-0613",
"max_retries": 6,
"temperature": 0,
"request_timeout": 60
},
"name": null,
"description": null,
"root": false,
"position": {
"x": 150.0,
"y": 360.0
},
"chain": "349ce049-9880-4811-9cf5-9f644cddded2"
}
},
{
"model": "chains.chainnode",
"pk": "3c83d7d4-7708-4d7e-9b38-1e493068f770",
"fields": {
"class_path": "ix.tools.metaphor.get_metaphor_find_similar",
"node_type": "89ef5872-b042-4551-8a14-6c9be2cadcc6",
"config": {
"verbose": false,
"return_direct": false
},
"name": null,
"description": null,
"root": false,
"position": {
"x": 820.0,
"y": 300.0
},
"chain": "349ce049-9880-4811-9cf5-9f644cddded2"
}
},
{
"model": "chains.chainnode",
"pk": "74d77d59-24f4-4e43-b067-f011b4b2d53e",
"fields": {
"class_path": "ix.tools.metaphor.get_metaphor_contents",
"node_type": "9ee6e9bc-f809-4b1e-841c-f775dd1038cc",
"config": {
"verbose": false,
"return_direct": false
},
"name": null,
"description": null,
"root": false,
"position": {
"x": 820.0,
"y": 460.0
},
"chain": "349ce049-9880-4811-9cf5-9f644cddded2"
}
},
{
"model": "chains.chainnode",
"pk": "ed91c79b-1d38-4d96-b60f-587322c3e058",
"fields": {
"class_path": "ix.tools.metaphor.get_metaphor_search",
"node_type": "a25f957a-8c72-45dd-a035-23e835008093",
"config": {
"verbose": false,
"return_direct": false
},
"name": null,
"description": null,
"root": false,
"position": {
"x": 820.0,
"y": 380.0
},
"chain": "349ce049-9880-4811-9cf5-9f644cddded2"
}
},
{
"model": "chains.chainnode",
"pk": "fdd474c9-78a7-495d-86d4-05523fdfbdd3",
"fields": {
"class_path": "ix.chains.loaders.agents.initialize_openai_multi_functions",
"node_type": "072d63be-45ef-4df2-8095-57a6560598ad",
"config": {
"verbose": false,
"max_iterations": 15,
"return_intermediate_steps": false
},
"name": null,
"description": null,
"root": true,
"position": {
"x": 460.0,
"y": 260.0
},
"chain": "349ce049-9880-4811-9cf5-9f644cddded2"
}
},
{
"model": "chains.chainedge",
"pk": "8725a4e1-1ba7-4d20-9d89-e45b0f995244",
"fields": {
"source": "2b96ae9e-bdd2-4410-8513-e849473c777d",
"target": "fdd474c9-78a7-495d-86d4-05523fdfbdd3",
"key": "llm",
"chain": "349ce049-9880-4811-9cf5-9f644cddded2",
"input_map": null,
"relation": "PROP"
}
},
{
"model": "chains.chainedge",
"pk": "b4d684c8-fd01-4321-91ef-e02ce454c28b",
"fields": {
"source": "74d77d59-24f4-4e43-b067-f011b4b2d53e",
"target": "fdd474c9-78a7-495d-86d4-05523fdfbdd3",
"key": "tools",
"chain": "349ce049-9880-4811-9cf5-9f644cddded2",
"input_map": null,
"relation": "PROP"
}
},
{
"model": "chains.chainedge",
"pk": "c615ddac-3866-46d8-97f2-5854fcdc91ff",
"fields": {
"source": "3c83d7d4-7708-4d7e-9b38-1e493068f770",
"target": "fdd474c9-78a7-495d-86d4-05523fdfbdd3",
"key": "tools",
"chain": "349ce049-9880-4811-9cf5-9f644cddded2",
"input_map": null,
"relation": "PROP"
}
},
{
"model": "chains.chainedge",
"pk": "e5e47eb0-fd65-4ffb-b5a0-896d5abc791d",
"fields": {
"source": "ed91c79b-1d38-4d96-b60f-587322c3e058",
"target": "fdd474c9-78a7-495d-86d4-05523fdfbdd3",
"key": "tools",
"chain": "349ce049-9880-4811-9cf5-9f644cddded2",
"input_map": null,
"relation": "PROP"
}
}
]
1 change: 1 addition & 0 deletions ix/task_log/management/commands/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def handle(self, *args, **options):
"agent/wikipedia",
"agent/klarna",
"agent/smithy",
"agent/metaphor",
]:
print(f"Loading fixture: {fixture}")
call_command("loaddata", fixture)
Expand Down

0 comments on commit 323bc11

Please sign in to comment.