-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b75919d
commit d27951b
Showing
7 changed files
with
51 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use anyhow::Result; | ||
use async_trait::async_trait; | ||
use futures::stream::BoxStream; | ||
use goose::{agent::Agent as GooseAgent, models::message::Message, systems::System}; | ||
|
||
#[async_trait] | ||
pub trait Agent { | ||
fn add_system(&mut self, system: Box<dyn System>); | ||
async fn reply(&self, messages: &[Message]) -> Result<BoxStream<'_, Result<Message>>>; | ||
} | ||
|
||
#[async_trait] | ||
impl Agent for GooseAgent { | ||
fn add_system(&mut self, system: Box<dyn System>) { | ||
self.add_system(system); | ||
} | ||
|
||
async fn reply(&self, messages: &[Message]) -> Result<BoxStream<'_, Result<Message>>> { | ||
self.reply(messages).await | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use anyhow::Result; | ||
use async_trait::async_trait; | ||
use futures::stream::BoxStream; | ||
use goose::{models::message::Message, systems::System}; | ||
|
||
use crate::agents::agent::Agent; | ||
|
||
pub struct MockAgent; | ||
|
||
#[async_trait] | ||
impl Agent for MockAgent { | ||
fn add_system(&mut self, _system: Box<dyn System>) { | ||
(); | ||
} | ||
|
||
async fn reply(&self, _messages: &[Message]) -> Result<BoxStream<'_, Result<Message>>> { | ||
Ok(Box::pin(futures::stream::empty())) | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pub mod agent; | ||
|
||
#[cfg(test)] | ||
pub mod mock_agent; |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
pub mod session; | ||
pub mod session_file; | ||
|
||
#[cfg(test)] | ||
pub mod mock_provider; |
This file contains 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