Skip to main content

A Geographical Knowledge Informed Code Evolver

Project description

from unicodedata import category

GeoEvolve

GeoEvolve aims to accelerate geospatial model discovery by the power of large language models.

CLI Usage

pip install geoevolve

export OPENAI_API_KEY='your-openai-api-key' && source ~/.zshrc

# Optional If you already have a GeoKnowRAG
# Build GeoKnowRAG
python ./build_geo_knowledge_db.py --geo_knowledge_dir ./geo_knowledge --working_dir ../geoevolve_storage --chunk_size 300 --chunk_overlap 50 --topic_file ./topics.json --add_knowledge True --collect_knowledge True --github_token your-github-token --embedding_model text-embedding-3-large --llm_model gpt-4.1

# Run GeoEvolve
python ./run_geoevolve.py --initial_program_path path-to-initial_program --evaluator_path path-to-evaluator --config_path path-to-config --total_rounds 10 --num_iterations_per_round 10 --output path-to-output --log_name your_program_name --embedding_model text-embedding-3-large --llm_model gpt-4.1;

Library Usage

import os
from geoevolve import save_wiki_pages, save_arxiv_papers, save_github_codes, initialize_or_get_geo_know_db, import_knowledge_into_geo_know_db, run_geo_evolution

os.environ['OPENAI_API_KEY'] = 'your-openai-api-key'
# Initialize an Empty GeoKnowRAG with Chroma
geokg_rag = initialize_or_get_geo_know_db(persist_dir='your_geoevolve_storage',
                                   embedding_model_name='text-embedding-3-large',
                                   llm_model_name='gpt-4.1')

# Run GeoEvolve
run_geo_evolution(initial_program_file='your-initial-program-path',
                  evaluator_file='your-evaluator-file',
                  config_path='your-config-path',
                  rounds=15,
                  iterations_per_round=15,
                  output_path='your-output-path',
                  log_name='your-program-name',
                  embedding_model_name='text-embedding-3-large',
                  llm_model_name='gpt-4.1')

Import Knowledge into GeoKnowRAG

from geoevolve import initialize_or_get_geo_know_db, import_knowledge_into_geo_know_db
from langchain_core.documents import Document

# You can import knowledge from a well-structured geographical knowledge directory
# The structure like geo_knowledge/{category}/{knowledge}.txt

import_knowledge_into_geo_know_db(geo_knowledge_dir='your_geo_knowledge_dir',
                                  persist_dir='your_geoevolve_storage',
                                  collection_name='your_collection_name',
                                  embedding_model_name='text-embedding-3-large',
                                  llm_model_name='gpt-4.1')

# You can also just import a document into the GeoKnowRAG
rag = initialize_or_get_geo_know_db(persist_dir='your_geoevolve_storage',
                                   embedding_model_name='text-embedding-3-large',
                                   llm_model_name='gpt-4.1')

knowledge = '...'
category = '...'
title = '...'

max_length = 1000
docs = []
if knowledge != '':
    if len(knowledge) > max_length:
        chunks = [knowledge[i:i + max_length] for i in
                  range(0, len(knowledge), max_length)]
        chunked_docs = [Document(page_content=chunk,
                                 metadata={'category': category, 'name': title})
                        for chunk in chunks]
        docs.extend(chunked_docs)
    else:
        doc = Document(page_content=knowledge,
                       metadata={'category': category, 'name': title})
        docs.append(doc)
rag.add_document_to_db(docs)

GeoEvolve: Automating Geospatial Model Discovery via Multi-Agent Large Language Models
Peng Luo, Xiayin Lou, Yu Zheng, Zhuo Zheng, Stefano Ermon

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geoevolve-0.2.5.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geoevolve-0.2.5-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file geoevolve-0.2.5.tar.gz.

File metadata

  • Download URL: geoevolve-0.2.5.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for geoevolve-0.2.5.tar.gz
Algorithm Hash digest
SHA256 156d1f82331ff5c98d3bc40141fee507f7ea2f8b68442a43fd42267ec37bb00f
MD5 984a9b695e3e2f452906e04c5efb3051
BLAKE2b-256 c30baf4963f52418412dfbc118638d62508404033c0aa924eb94b5c7e2050b5b

See more details on using hashes here.

File details

Details for the file geoevolve-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: geoevolve-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for geoevolve-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 61ccfdec5a736f01c0aa70659663b4c8d4d40c429624ec8f9262bdd0704be6f0
MD5 391bd24cd40c98a640f92444c2956d9c
BLAKE2b-256 bd0e71fc15b4c7e0ecc472d0797d4ce249efa09027248833fc596e09a95dafd3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page