Remove Perigon News integration and related SDK components
The Perigon News integration, SDK, and associated tools were removed from the repository. This includes the agent script, API SDK, and OpenAPI definitions for managing news-related operations. The changes simplify the codebase, eliminating unused or outdated dependencies.
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
<script>
|
||||
async function sendRequest() {
|
||||
const input = document.getElementById('userInput').value;
|
||||
const response = await fetch(`/api/webhooks?resource=web-search&input=${encodeURIComponent(input)}`);
|
||||
const response = await fetch(`/api/agents?resource=web-search&input=${encodeURIComponent(input)}`);
|
||||
const reader = response.body.getReader();
|
||||
const decoder = new TextDecoder('utf-8');
|
||||
let result = '';
|
||||
|
@@ -1,15 +1,3 @@
|
||||
# genaiscript-rust-shim
|
||||
|
||||
To install dependencies:
|
||||
|
||||
```bash
|
||||
bun install
|
||||
```
|
||||
|
||||
To run:
|
||||
|
||||
```bash
|
||||
bun run index.ts
|
||||
```
|
||||
|
||||
This project was created using `bun init` in bun v1.1.36. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
||||
simple package that wraps genaiscript for binding to `tokio::process::Command`
|
@@ -1,24 +0,0 @@
|
||||
import {PerigonClient as NewsSearchTool} from "@agentic/perigon";
|
||||
|
||||
script({
|
||||
system: ["system.tools"],
|
||||
tools: "agent",
|
||||
maxTokens: 8192
|
||||
})
|
||||
|
||||
const newSearchTool = new NewsSearchTool();
|
||||
|
||||
defTool(newSearchTool)
|
||||
|
||||
$`You are a chat assistant that uses agent tools to solve problems.
|
||||
|
||||
while true:
|
||||
- ask the user for a question using the agent_user_input
|
||||
- make a plan to answer the question step by step
|
||||
- answer the question
|
||||
end while
|
||||
|
||||
## guidance:
|
||||
- use the agent tools to help you
|
||||
- do NOT try to ask the user questions directly, use the agent_user_input tool instead.
|
||||
`
|
@@ -1,106 +0,0 @@
|
||||
import type * as types from './types';
|
||||
import type { ConfigOptions, FetchResponse } from 'api/dist/core'
|
||||
import Oas from 'oas';
|
||||
import APICore from 'api/dist/core';
|
||||
import definition from './openapi.json';
|
||||
|
||||
class SDK {
|
||||
spec: Oas;
|
||||
core: APICore;
|
||||
|
||||
constructor() {
|
||||
this.spec = Oas.init(definition);
|
||||
this.core = new APICore(this.spec, 'perigon/unknown (api/6.1.3)');
|
||||
}
|
||||
|
||||
/**
|
||||
* Optionally configure various options that the SDK allows.
|
||||
*
|
||||
* @param config Object of supported SDK options and toggles.
|
||||
* @param config.timeout Override the default `fetch` request timeout of 30 seconds. This number
|
||||
* should be represented in milliseconds.
|
||||
*/
|
||||
config(config: ConfigOptions) {
|
||||
this.core.setConfig(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the API you're using requires authentication you can supply the required credentials
|
||||
* through this method and the library will magically determine how they should be used
|
||||
* within your API request.
|
||||
*
|
||||
* With the exception of OpenID and MutualTLS, it supports all forms of authentication
|
||||
* supported by the OpenAPI specification.
|
||||
*
|
||||
* @example <caption>HTTP Basic auth</caption>
|
||||
* sdk.auth('username', 'password');
|
||||
*
|
||||
* @example <caption>Bearer tokens (HTTP or OAuth 2)</caption>
|
||||
* sdk.auth('myBearerToken');
|
||||
*
|
||||
* @example <caption>API Keys</caption>
|
||||
* sdk.auth('myApiKey');
|
||||
*
|
||||
* @see {@link https://spec.openapis.org/oas/v3.0.3#fixed-fields-22}
|
||||
* @see {@link https://spec.openapis.org/oas/v3.1.0#fixed-fields-22}
|
||||
* @param values Your auth credentials for the API; can specify up to two strings or numbers.
|
||||
*/
|
||||
auth(...values: string[] | number[]) {
|
||||
this.core.setAuth(...values);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the API you're using offers alternate server URLs, and server variables, you can tell
|
||||
* the SDK which one to use with this method. To use it you can supply either one of the
|
||||
* server URLs that are contained within the OpenAPI definition (along with any server
|
||||
* variables), or you can pass it a fully qualified URL to use (that may or may not exist
|
||||
* within the OpenAPI definition).
|
||||
*
|
||||
* @example <caption>Server URL with server variables</caption>
|
||||
* sdk.server('https://{region}.api.example.com/{basePath}', {
|
||||
* name: 'eu',
|
||||
* basePath: 'v14',
|
||||
* });
|
||||
*
|
||||
* @example <caption>Fully qualified server URL</caption>
|
||||
* sdk.server('https://eu.api.example.com/v14');
|
||||
*
|
||||
* @param url Server URL
|
||||
* @param variables An object of variables to replace into the server URL.
|
||||
*/
|
||||
server(url: string, variables = {}) {
|
||||
this.core.setServer(url, variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search and filter all news articles available via the Perigon API. The result includes a
|
||||
* list of individual articles that were matched to your specific criteria.
|
||||
*
|
||||
* @summary All Articles
|
||||
* @throws FetchError<400, types.AllNewsResponse400> 400
|
||||
* @throws FetchError<401, types.AllNewsResponse401> 401
|
||||
* @throws FetchError<403, types.AllNewsResponse403> 403
|
||||
* @throws FetchError<404, types.AllNewsResponse404> 404
|
||||
* @throws FetchError<500, types.AllNewsResponse500> 500
|
||||
*/
|
||||
allNews(metadata: types.AllNewsMetadataParam): Promise<FetchResponse<200, types.AllNewsResponse200>> {
|
||||
return this.core.fetch('/v1/all', 'get', metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stories
|
||||
*
|
||||
* @throws FetchError<400, types.Stories1Response400> 400
|
||||
*/
|
||||
stories1(metadata: types.Stories1MetadataParam): Promise<FetchResponse<200, types.Stories1Response200>> {
|
||||
return this.core.fetch('/v1/stories/all', 'get', metadata);
|
||||
}
|
||||
}
|
||||
|
||||
const createSDK = (() => { return new SDK(); })()
|
||||
;
|
||||
|
||||
export default createSDK;
|
||||
|
||||
export type { AllNewsMetadataParam, AllNewsResponse200, AllNewsResponse400, AllNewsResponse401, AllNewsResponse403, AllNewsResponse404, AllNewsResponse500, Stories1MetadataParam, Stories1Response200, Stories1Response400 } from './types';
|
File diff suppressed because one or more lines are too long
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"name": "@web-agent-rs/perigon",
|
||||
"version": "0.0.0",
|
||||
"main": "index.ts",
|
||||
"types": "./index.d.ts",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"api": "^6.1.3",
|
||||
"json-schema-to-ts": "^2.8.0-beta.0",
|
||||
"oas": "^20.11.0"
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
@@ -1,13 +0,0 @@
|
||||
import type { FromSchema } from 'json-schema-to-ts';
|
||||
import * as schemas from './schemas';
|
||||
|
||||
export type AllNewsMetadataParam = FromSchema<typeof schemas.AllNews.metadata>;
|
||||
export type AllNewsResponse200 = FromSchema<typeof schemas.AllNews.response['200']>;
|
||||
export type AllNewsResponse400 = FromSchema<typeof schemas.AllNews.response['400']>;
|
||||
export type AllNewsResponse401 = FromSchema<typeof schemas.AllNews.response['401']>;
|
||||
export type AllNewsResponse403 = FromSchema<typeof schemas.AllNews.response['403']>;
|
||||
export type AllNewsResponse404 = FromSchema<typeof schemas.AllNews.response['404']>;
|
||||
export type AllNewsResponse500 = FromSchema<typeof schemas.AllNews.response['500']>;
|
||||
export type Stories1MetadataParam = FromSchema<typeof schemas.Stories1.metadata>;
|
||||
export type Stories1Response200 = FromSchema<typeof schemas.Stories1.response['200']>;
|
||||
export type Stories1Response400 = FromSchema<typeof schemas.Stories1.response['400']>;
|
@@ -22,7 +22,7 @@ lazy_static! {
|
||||
));
|
||||
}
|
||||
|
||||
pub async fn handle_webhooks(Path(agent_id): Path<String>) -> impl IntoResponse {
|
||||
pub async fn use_agent(Path(agent_id): Path<String>) -> impl IntoResponse {
|
||||
let db = DB.lock().await;
|
||||
match db.get(&agent_id) {
|
||||
Ok(Some(data)) => {
|
||||
@@ -194,7 +194,7 @@ struct WebhookPostResponse {
|
||||
stream_url: String,
|
||||
}
|
||||
|
||||
pub async fn handle_webhooks_post(Json(payload): Json<WebhookPostRequest>) -> impl IntoResponse {
|
||||
pub async fn create_agent(Json(payload): Json<WebhookPostRequest>) -> impl IntoResponse {
|
||||
let db = DB.lock().await;
|
||||
|
||||
tracing::info!("Received webhook post request with ID: {}", payload.id);
|
@@ -1,5 +1,3 @@
|
||||
|
||||
// src/handlers/mod.rs
|
||||
pub mod not_found;
|
||||
pub mod ui;
|
||||
pub mod webhooks;
|
||||
pub mod agents;
|
@@ -1,5 +1,5 @@
|
||||
use crate::handlers::webhooks::handle_webhooks_post;
|
||||
use crate::handlers::{not_found::handle_not_found, ui::serve_ui, webhooks::handle_webhooks};
|
||||
use crate::handlers::agents::create_agent;
|
||||
use crate::handlers::{not_found::handle_not_found, ui::serve_ui, agents::use_agent};
|
||||
use axum::routing::post;
|
||||
use axum::routing::{get, Router};
|
||||
use tower_http::trace::{self, TraceLayer};
|
||||
@@ -9,9 +9,9 @@ pub fn create_router() -> Router {
|
||||
Router::new()
|
||||
.route("/", get(serve_ui))
|
||||
// create an agent
|
||||
.route("/api/agents", post(handle_webhooks_post))
|
||||
.route("/api/agents", post(create_agent))
|
||||
// connect the agent
|
||||
.route("/agents/:agent_id", get(handle_webhooks))
|
||||
.route("/agents/:agent_id", get(use_agent))
|
||||
.route("/health", get(health))
|
||||
.layer(
|
||||
TraceLayer::new_for_http()
|
||||
|
Reference in New Issue
Block a user